‘sys.excepthook’ and threading

I just stumbled over this problem and as it turns out, it was the right time to do so.

New in version 3.8: threading.excepthook

Handle uncaught exception raised by Thread.run().

The args argument has the following attributes:

exc_type: Exception type.
exc_value: Exception value, can be None.
exc_traceback: Exception traceback, can be None.
thread: Thread which raised the exception, can be None.

I don’t know why, but be aware, that unlike sys.excepthook, threading.excepthook receives the arguments as a namedtuple instead of multiple arguments.

Leave a Comment