Last active
August 29, 2015 14:00
-
-
Save soldni/7a93107cac59734f4384 to your computer and use it in GitHub Desktop.
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 | |
# BEGIN PYTHONPATH FIX # | |
# appends root of project if PYTHONPATH is not set; | |
# relies on the presence of .git in project root. | |
root_proj_path = os.getcwd() | |
root_flag = False | |
while not('.git' in os.listdir(root_proj_path)) and not(root_flag): | |
if root_proj_path == '/': | |
root_flag = True | |
root_proj_path = os.path.split(root_proj_path)[0] | |
print root_proj_path | |
if not(root_proj_path in sys.path) and not(root_flag): | |
sys.path.append(root_proj_path) | |
# END PYTHONPATH FIX # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment