浏览代码

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

Thomas Kluyver 11 年之前
父节点
当前提交
4fe051ea15
共有 1 个文件被更改,包括 5 次插入2 次删除
  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}()