def exception_hook(t, val, tb): QMessageBox.critical(None, "An exception was raised", "Exception type: {}".format(t)) old_exception_hook(t, val, tb)