Commits

Anonymous committed b3c77e3

Fix setupenv.sh if PYTHONPATH is not set

  • Participants
  • Parent commits a35f2c9

Comments (0)

Files changed (1)

 export PYTHONPATH=`cat << EOF | /usr/bin/env python -
 from os import environ, getcwd
 
-subprojects=[ 
+subprojects=[
 "hachoir-core",
 "hachoir-parser",
 "hachoir-editor",
 ]
 
 cur_dir = getcwd()
-path_list = environ["PYTHONPATH"].split(':')
+
 try:
-  #occurs when the path is set but empty
-  path_list.remove('')
-except ValueError:
-  pass
+  path_list = environ["PYTHONPATH"].split(':')
+  try:
+    #occurs when the path is set but empty
+    path_list.remove('')
+  except ValueError:
+    pass
+except KeyError:
+  # occurs when PYTHONPATH is not set at all
+  path_list = []
 
 for project in subprojects:
   path_item = "%s/%s" % (cur_dir, project)