Created
July 24, 2013 17:51
-
-
Save MattDietz/6072825 to your computer and use it in GitHub Desktop.
Finding python tree root
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
import os | |
import sys | |
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), | |
os.pardir, | |
os.pardir)) | |
if os.path.exists(os.path.join(possible_topdir, '<project name>', '__init__.py')): | |
sys.path.insert(0, possible_topdir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment