From c7690ad759940fe124995b1b5f0b934b8c7c8539 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 4 Nov 2017 22:30:10 +0100 Subject: [PATCH] Fix exceptions on PyQt5 crashing entire application --- source/carla_host.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/carla_host.py b/source/carla_host.py index 1daf98610..89ba4d525 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -60,6 +60,12 @@ try: except: hasGL = False +# ------------------------------------------------------------------------------------------------------------ +# Safe exception hook, needed for PyQt5 + +def sys_excepthook(type, value, tback): + return sys.__excepthook__(type, value, tback) + # ------------------------------------------------------------------------------------------------------------ # Session Management support @@ -2492,6 +2498,9 @@ def initHost(initName, libPrefix, isControl, isPlugin, failError, HostClass = No sys.stdout = CarlaPrint(False) sys.stderr = CarlaPrint(True) + if config_UseQt5: + sys.excepthook = sys_excepthook + # -------------------------------------------------------------------------------------------------------- # Done