get working dir from python script's real path

since, for example in the docker container, it was trying to grab the dirname from the 'zeronet.py' relative path which has no path
This commit is contained in:
Roberto C. Morano 2016-12-01 13:41:29 +01:00 committed by GitHub
parent 47744c1a0c
commit 8b7bd2d572

View file

@ -10,9 +10,10 @@ def main():
main = None main = None
try: try:
os.chdir(os.path.dirname(__file__)) # Change working dir to zeronet.py dir app_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src/lib")) # External liblary directory os.chdir(app_dir) # Change working dir to zeronet.py dir
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) # Imports relative to src sys.path.insert(0, os.path.join(app_dir, "src/lib")) # External liblary directory
sys.path.insert(0, os.path.join(app_dir, "src")) # Imports relative to src
import main import main
main.start() main.start()
if main.update_after_shutdown: # Updater if main.update_after_shutdown: # Updater