Commit e64c4dc4 authored by 3Yan's avatar 3Yan
Browse files

Windows exception handling routine added

* After crash, the CLI window should now wait for keypress before closing.
parent 20fb193a
...@@ -44,6 +44,13 @@ class QStatusBarLogger(logging.Handler): ...@@ -44,6 +44,13 @@ class QStatusBarLogger(logging.Handler):
self.trigger.signal.emit() self.trigger.signal.emit()
def show_exception_and_exit(exc_type, exc_value, tb):
import traceback
traceback.print_exception(exc_type, exc_value, tb)
raw_input("Press key to exit.")
sys.exit(-1)
def load_file(parent, augCanvas, update, settings, loadthread, filename=None): def load_file(parent, augCanvas, update, settings, loadthread, filename=None):
"""populates dataset and plots it""" """populates dataset and plots it"""
directory = augCanvas.filename or settings.value("open_folder") directory = augCanvas.filename or settings.value("open_folder")
...@@ -243,6 +250,9 @@ def about(parent): ...@@ -243,6 +250,9 @@ def about(parent):
def main(): def main():
# thx to: https://stackoverflow.com/questions/779675/stop-python-from-closing-on-error/781074#781074
sys.excepthook = show_exception_and_exit
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
loadthread = QtCore.QThread() loadthread = QtCore.QThread()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment