X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fexception_handler.py;h=9e54fa69825bb27e971f2c2875a69cc05f8c038f;hb=30e2d1dd4de05196b9d9f1268732cca50573f700;hp=ae3b82f5eee8c1970a06a134920d10b8b11176e8;hpb=680617324b88f51858e9de9652679d268cf90be4;p=bertos.git diff --git a/wizard/exception_handler.py b/wizard/exception_handler.py index ae3b82f5..9e54fa69 100644 --- a/wizard/exception_handler.py +++ b/wizard/exception_handler.py @@ -42,17 +42,22 @@ from PyQt4.QtGui import * def _excepthook(exc_type, exc_value, exc_traceback): project_dir = QApplication.instance().project.info("PROJECT_PATH") + if not project_dir: + project_dir = os.getcwd() file_name = os.path.join(project_dir, "wizard_error.log") if os.path.exists(file_name): content = open(file_name, "r").read() else: content = "" + if not os.path.exists(os.path.dirname(file_name)): + os.makedirs(os.path.dirname(file_name)) f = open(file_name, "w") message = "\n".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) f.write(message) f.write(">"*80 + "\n") f.write(content) f.close() + print>>sys.stderr, message QMessageBox.critical( None, "Exception occurred",