This would not be a problem if you could just re-raise the
exception. You CAN raise the same exception - not quite the
same thing as the traceback now will point to your raise
of the exception, not the original error which you were not
prepared to handle. ( OK if I'm the only user of the code,
but a dirty trick to play on someone else! :-)
This thread on printing of tracebacks has reminded me of
that problem, but it has also suggested a solution:
I propose that the 'raise' statement be given an optional
third parameter, which would be a traceback object.
A *REAL* reraise of an exception would then be:
raise sys.exc_type, sys.exc_value, sys.exc_traceback
(Keeping the original traceback )
And Tom Burnette's problem would become:
raise sys.exc_type, sys.exc_value,sys.exc_traceback.tb_last.tb_last
'raise exception,value' would still generate a new traceback.
- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics