This should be fine now..

This commit is contained in:
Thomas-Karl Pietrowski 2016-04-21 19:09:15 +02:00
parent 61069e9a71
commit 1a52454165

View File

@ -13,18 +13,14 @@ import sys
# This can cause issues such as having libsip loaded from # This can cause issues such as having libsip loaded from
# the system instead of the one provided with Cura, which causes # the system instead of the one provided with Cura, which causes
# incompatibility issues with libArcus # incompatibility issues with libArcus
if "PYTHONPATH" in os.environ.keys(): # If PYTHONPATH is used if "PYTHONPATH" in os.environ.keys(): # If PYTHONPATH is used
PYTHONPATH = os.environ["PYTHONPATH"] PYTHONPATH = os.environ["PYTHONPATH"].split(os.pathsep) # Get the value, split it..
PYTHONPATH = PYTHONPATH.split(os.pathsep) PYTHONPATH = PYTHONPATH.reverse() # and reverse it, because we always insert at 1
PYTHONPATH_real = os.path.realpath(PYTHONPATH[0]) for PATH in PYTHONPATH: # Now beginning with the last PATH
PYTHONPATH = PYTHONPATH[1:] PATH_real = os.path.realpath(PATH) # Making the the path "real"
while PYTHONPATH: if PATH_real in sys.path: # This should always work, but keep it to be sure..
PYTHONPATH_real += ":%s" %(os.path.realpath(PYTHONPATH[0])) sys.path.remove(PATH_real)
PYTHONPATH = PYTHONPATH[1:] sys.path.insert(1, PATH_real) # Insert it at 1 before os.curdir, which is 0.
if sys.path[1] != PYTHONPATH_real: # .. check whether PYTHONPATH is placed incorrectly.
sys.path.remove(PYTHONPATH_real) # If so, remove that element..
sys.path.insert(1, PYTHONPATH_real) # and add it at the correct place again.
def exceptHook(hook_type, value, traceback): def exceptHook(hook_type, value, traceback):
import cura.CrashHandler import cura.CrashHandler