|
@@ -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}()
|