Hello, you could redirect the interpreter’s standard error output stream: sys.stderr = YourClass(window.edit, sys.__stderr__, QColor(Qt.red)) YourClass in an "file-like" object (it has an write function) window.edit is an instance of Qt's QTextEdit class and is used to display the message.
Here is an example: http://series60-remote.svn.sf.net/viewvc/series60- remote/trunk/pc/series60-remote.py?view=markup , line 288 The class QtOutput is defined here: http://series60- remote.svn.sf.net/viewvc/series60- remote/trunk/pc/lib/log.py?revision=257&view=markup , line 36 And the window that actually displays an error message is here: http://series60-remote.svn.sf.net/viewvc/series60- remote/trunk/pc/window/log.py?view=markup A screenshot is here: http://imagebin.ca/view/5rSa--2X.html The Traceback is colored red in the window. Starting with this is should be easy to get a "report bug"-dialog ;-) If you have any questions please just ask. Greetings, Lukas Am Donnerstag 07 Mai 2009 13:17:54 schrieb Jeremy Sanders: > Is there a way to catch Python exceptions in all parts of a PyQt program? > > I have a "report bug" dialog box which gets called if an exception occurs > in the most frequently used parts of my program, but it would be nice if I > could catch every unhandled exception globally. > > The really nice thing about python is that program tends to keep running > despite an exception in a slot, so we don't get immediate data loss. > > Thanks > > Jeremy _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
