exceptions, internals (introspection?)

Paul Rubin http
Thu Nov 10 17:27:32 EST 2005


"ej" <ej at wellkeeper com> writes:
>     for key in dir(traceback_):
>         print "traceback_.%s =" % key, eval("traceback_.%s" % key)

Don't use eval for this.  Use getattr(traceback_, key).

> traceback_.tb_frame = <frame object at 0x8177b3c>
> traceback_.tb_lasti = 18
> traceback_.tb_lineno = 6
> traceback_.tb_next = None

Yeah.  As /F mentioned, there's also a traceback module that parses
this stuff out for you.



More information about the Python-list mailing list