Browse Source

Merge branch 'master' of github.com:takluyver/pynsist

Thomas Kluyver 11 years ago
parent
commit
4fe051ea15
1 changed files with 5 additions and 2 deletions
  1. 5 2
      nsist/__init__.py

+ 5 - 2
nsist/__init__.py

@@ -153,12 +153,15 @@ pkgdir = os.path.join(scriptdir, 'pkgs')
 sys.path.insert(0, pkgdir)
 os.environ['PYTHONPATH'] = pkgdir + os.pathsep + os.environ.get('PYTHONPATH', '')
 
+appdata = os.environ.get('APPDATA', None)
 def excepthook(etype, value, tb):
     "Write unhandled exceptions to a file rather than exiting silently."
     import traceback
-    with open(os.path.join(scriptdir, script+'.log'), 'w') as f:
+    with open(os.path.join(appdata, script+'.log'), 'w') as f:
         traceback.print_exception(etype, value, tb, file=f)
-sys.excepthook = excepthook
+
+if appdata:
+    sys.excepthook = excepthook
 
 from {module} import {func}
 {func}()