At Tuesday 3/10/2006 02:15, Bryan wrote: >i would like to save an exception and reraise it at a later time. >def foo(): >Â Â try: >Â Â Â Â 1/0 >Â Â except Exception, e: >Â Â Â Â exception = e > >if exception: raise exception > >with the above code, i'm able to successfully raise the exception, but the >line number of the exception is at the place of the explicit raise instead >of the where the exception originally occurred. Â is there anyway to fix >this?
The raise statement has 3 arguments, the third being the traceback (not used so much, except in cases like yours). You can get the values using sys.exc_info() (Don't store the traceback more than needed because it holds a reference to all previous stack frames...) Gabriel Genellina Softlab SRL __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list