0

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.

2
  • Could you provide further context? You get an exception when you run something from the shell, but.... when running in a GUI you still get it? What logging/handling is the GUI doing itself that's different from you launching whatever it is you're doing directly etc...? Commented Nov 11, 2013 at 11:21
  • Sorry I wasn't clear enough. I suspect I still get that exception, but there is no indication of it when running from gui. I can only read the exception message when starting from shell(cmd.exe). I'm using wxpython for my GUI framework. The error message reads like this: <code>Exception in thread Thread-35 (most likely raised during interpreter shutdown):</code> Commented Nov 11, 2013 at 12:44

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.