Created
February 27, 2014 23:04
-
-
Save happysundar/9261574 to your computer and use it in GitHub Desktop.
How to find the path of the current (executing) python script
From http://stackoverflow.com/questions/3718657/how-to-properly-determine-current-script-directory-in-python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__filename = inspect.getframeinfo(inspect.currentframe()).filename | |
__path = os.path.dirname(os.path.abspath(filename)) | |
# And then, do something like: | |
if not os.path.isabs(arguments['--bound-spec']): | |
arguments['--bound-spec'] = os.path.normpath(os.path.join(__path, arguments['--bound-spec'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment