Add excepthook

This commit is contained in:
Milan Nikolic 2021-12-22 14:07:01 +01:00
parent ae94cf124c
commit 745965c62f
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75

View file

@ -19,6 +19,7 @@
import os
import sys
import signal
import traceback
if os.path.isdir(os.path.join("..", "src")) and os.path.isfile(
os.path.join("..", "setup.py")):
@ -41,6 +42,13 @@ except ImportError as err:
os.linesep, str(err), os.linesep))
sys.exit(1)
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
return
print("".join(traceback.format_exception(exc_type, exc_value, exc_traceback)))
sys.exit(1)
sys.excepthook = handle_exception
if __name__ == "__main__":
QApplication.setAttribute(Qt.AA_X11InitThreads)