Where should i use an except block in order to log exceptions of a QApplication
?
This doesn't seem to work:
app = QtGui.QApplication(sys.argv)
MainWindow = MainWindow()
MainWindow.show()
try:
eventLoop = app.exec_()
except Exception, e:
log.exception(str(e))
as the exception won't even reach that block.
I solved it by overriding the excepthook
, as seen in the following answer: Logging All Exceptions in a pyqt4 app