Overriding traceback print_exc()?

dakman at gmail.com dakman at gmail.com
Tue Oct 31 20:09:12 CET 2006


You could always override sys.stderr with a instance of your own with a
write() method. Though you will still have to catch the exceptions.

Bob Greschke wrote:
> I want to cause any traceback output from my applications to show up in one
> of my dialog boxes, instead of in the command or terminal window (between
> running on Solaris, Linux, OSX and Windows systems there might not be any
> command window or terminal window to show the traceback messages in).  Do I
> want to do something like override the print_exc (or format_exc?) method of
> traceback to get the text of the message and call my dialog box routine?  If
> that is right how do I do that (monkeying with classes is all still a grey
> area to me)?
>
> I kind of understand using the traceback module to alter the output of
> exceptions that I am looking for, but I'm after those pesky ones that should
> never happen. :)
> 
> Thanks!
> 
> Bob




More information about the Python-list mailing list