Last active
August 29, 2015 14:17
-
-
Save tsalo/04f46174e0bc0c3e36bb to your computer and use it in GitHub Desktop.
Get directory of script. Also, get parent directory. Add to the beginning of a script to help you load files in the same directory as the script. Makes projects more portable.
This file contains 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
""" | |
Get directory of script. Also, get parent directory. | |
""" | |
import os.path | |
code_dir = os.path.dirname(__file__) | |
par_dir = os.path.abspath(os.path.join(code_dir, os.path.pardir)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment