I have a Windows app originally written in Python 3.4 with PyQt4 which had stderr redirected to a dialog box by means of signals and slots. This posting describes how I got it working (see the final code at the end). It worked great, catching all the nice detailed stderr messages you would normally see on the console. Here is a typical screen shot:
When I installed Python 3.5.2, PyQt5, and upgraded several of my packages, though, it no longer worked. Now when I hit an error my entire app shuts down immediately and I have no way to trace the error.
When I run my app in the pydev debugger, however, my nice windowed stderr messages are back. I have the debugger set to break on all errors, which it does, and this allows my windowed stderr text to appear.
There is another way to get the windowed error messages back, too: revert one of my core packages (lmfit) from the most recent 0.9.5 to the earlier 0.9.3 I was using.
Can anyone suggest what might be happening? I've asked the lmfit developers what they might have changed and tried a dozen different alternatives with no luck.
Filtering stderr messages is somewhat hackish. Use an excepthook to centralise the processing of unhandled exceptions. The traceback module can be used for formatting the exceptions in various ways.
If you also want to process Qt messages, use qInstallMessageHandler. To format these messages, you can use qFormatLogMessage and qSetMessagePattern. All these functions are in the QtCore module.