traceback output to a network connection

Fernando Pérez fperez528 at yahoo.com
Thu Apr 18 22:58:43 EDT 2002


Henning Peters wrote:

> hi NG,
> 
> for debugging a network server i would like to show the parser's traceback
> output on my network client. I figured out that the built-in traceback
> module would be a good choice, but it seems, that the traceback-methods are
> limited to write only to open file handlers.
> 
> is there a known way to relay this stuff to an open network socket
> connection?
> thanks...
> 
> bye,
> henning

define your own traceback handler and assign it to sys.excepthook. Then you 
can do whatever you want in it: print, log, whatever. Look at the code for 
the standard cgitb module for an example which generates html tracebacks 
instead of plain text.

f.



More information about the Python-list mailing list