traceback manipulation

hg hansgeunsmeyer at earthlink.net
Sun Dec 8 22:25:21 EST 2002


> If a exception occours, the daemon catches it and the client it 
> re-raising it. However in the traceback on the client I only see the 
> line in the client code, that re-raises the exception
> ( exec "raise %s, '%s'" % (type, string) )
> However I'd like to replace the traceback with the server's one...
> 
> Any ideas?

When an exception occurs you could perhaps return sys.exc_info().
Then, in the client, you could -- for instance -- check if you got a
triple (tp, val, tb) back with an Exception as first element, and if
so, you could try to call traceback.print_exception(tp, val, tb, None,
None).  (This doesn't exactly re-raise the exception, but it does give
you the original traceback.)

Hans



More information about the Python-list mailing list