From 7ac1f6d3fe6d6bc7203d38c6f0015294e2590366 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 8 Jan 2017 20:30:34 +1000 Subject: [PATCH] fix DEBUG=1 the errors.py code was overwriting the excepthook installed in qt.py --- aqt/errors.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/aqt/errors.py b/aqt/errors.py index 5a01f2db1..836308b35 100644 --- a/aqt/errors.py +++ b/aqt/errors.py @@ -8,11 +8,12 @@ from anki.lang import _ from aqt.qt import * from aqt.utils import showText, showWarning -def excepthook(etype,val,tb): - sys.stderr.write("Caught exception:\n%s%s\n" % ( - ''.join(traceback.format_tb(tb)), - '{0}: {1}'.format(etype, val))) -sys.excepthook = excepthook +if not os.environ.get("DEBUG"): + def excepthook(etype,val,tb): + sys.stderr.write("Caught exception:\n%s%s\n" % ( + ''.join(traceback.format_tb(tb)), + '{0}: {1}'.format(etype, val))) + sys.excepthook = excepthook class ErrorHandler(QObject): "Catch stderr and write into buffer."