13 lines
417 B
Python
13 lines
417 B
Python
|
import os
|
||
|
|
||
|
def project_home():
|
||
|
path = os.environ.get('PYTHONPATH')
|
||
|
if not path:
|
||
|
raise Exception('No environment variables of PYTHONPATH.')
|
||
|
here = os.path.dirname(__file__).replace("\\", '/')
|
||
|
for j in [i.replace("\\", '/').strip() for i in path.split(os.pathsep)]:
|
||
|
if here.startswith(j):
|
||
|
return j
|
||
|
else:
|
||
|
raise Exception('Project directory is not in PYTHONPATH.')
|