Traceback Questions

ncf nothingcanfulfill at gmail.com
Fri Aug 19 01:49:24 CEST 2005


I'm just beginning with tracebacks, building off of what I see in
asyncore's compact_traceback code, in order to hopefully store all the
values from the location in which the exception occured.

I'm actually trying to make this into a python bug report system for my
current project, and am seeking advice on how to use sys.exc_info()[2]
better (the traceback element)

Does anyone have any advice on how I'd preform a traceback-based
bugreport-like system? The more I work on this, the more I'm confusing
myself. :\

-Wes



This is the code from which I'm slowly figuring out the traceback
stuff:
import sys,pprint
a,b = 1,0
def mth(a,b):
    moo = a/b
try:
    mth(a,b)
except:
    pass
tb = sys.exc_info()[2]
assert tb
def sprint(o):
    pprint.pprint(dict([(x, getattr(o, x)) for x in dir(o) if
x[:2]!='__']), indent=2)
sprint(tb)
sprint(tb.tb_frame)
sprint(tb.tb_frame.f_code)




More information about the Python-list mailing list