eval errors tracing

Tigra tigra_564 at mail.ru
Wed Aug 22 07:06:07 EDT 2001


> Check out the traceback module, especially the print_tb and format_tb
> functions:
> 
>     http://www.python.org/doc/current/lib/module-traceback.html
> 
> They are typically called like
> 
>     traceback.print_tb(sys.get_exc_info()[2])

I don't want to get errors printed as the standard tools do. I want to get the
line number and do some complicated manupulations with it (they are really more
than just string.zfill(lineno, 4)). For now I use a dirty hack:
get str(exc_info()[1]), then find by a regexp the line number, then do what I want.
But I consider dirty hacks aren't the best solutions.

Sergey



More information about the Python-list mailing list