Alexander Pope
Alexander Pope

Reputation: 1224

Python exceptions

Is there a way to catch exceptions that happen during interpreter shutdown?

I have a gui application, and sometimes I get a thread error during interpreter shutdown, but I can only see this exception when I start the program from cmd.exe in the shell. I would like to log this exception into one of my log files, but I can't find a way to first catch it.

Upvotes: 0

Views: 128

Answers (1)

Sven Marnach
Sven Marnach

Reputation: 602535

One thing you can try is to overwrite sys.excepthook() with your own function to write the exception somewhere else than to stderr.

Upvotes: 1

Related Questions