def resource_path(level = 2):
    module = sys._getframe(level).f_globals.get('__name__', '__main__')

    if module != '__main__':
        # Return the path to the module:
        try:
            return dirname(getattr(sys.modules.get(module), '__file__'))
        except:
            # Apparently 'module' is not a registered module...treat it like
            # '__main__':
            pass

    # '__main__' is not a real module, so we need a work around:
    for path in [ dirname(sys.argv[0] ), getcwd()]:
        if exists(path):
            break

    return path

#### EOF ######################################################################
Return a resource path calculated from the caller's stack.
dataset/ETHPy150Open enthought/pyface/pyface/resource/resource_path.py/resource_path