Browse Source

exceptionhook

master
Nils 3 years ago
parent
commit
4ad04aa95d
  1. 12
      bug01/main.py

12
bug01/main.py

@ -63,6 +63,18 @@ except:
pass
#Catch Exceptions even if PyQt crashes.
import sys
sys._excepthook = sys.excepthook
def exception_hook(exctype, value, traceback):
"""This hook purely exists to call sys.exit(1) even on a Qt crash
so that atexit gets triggered"""
#print(exctype, value, traceback)
logger.error("Caught crash in execpthook. Trying too execute atexit anyway")
sys._excepthook(exctype, value, traceback)
sys.exit(1)
sys.excepthook = exception_hook
scene = QtWidgets.QGraphicsScene()

Loading…
Cancel
Save