eval errors tracing

Skip Montanaro skip at pobox.com
Tue Aug 21 14:12:30 EDT 2001


    tigra> How can I catch the SyntaxError exception and get the real line
    tigra> number from it?

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])

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list