can't print the exception cause/context in Python3.0?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Mar 7 16:21:16 CET 2009


En Sat, 07 Mar 2009 11:46:08 -0200, BigHand <heweiwei at gmail.com> escribió:

> Here is copy from my IDLE of python 3.0
>
>
>>>> traceback.print_tb(exc_tb)
>   File "<pyshell#14>", line 2, in <module>
>   File "<pyshell#6>", line 2, in a
>   File "<pyshell#9>", line 2, in b
>
> but this doesn't output the cause/context like 2.6: or on the sample
> of:
> http://docs.python.org/3.0/library/traceback.html?highlight=format_exception#traceback.format_exception
>
> I want the exception printted like this:
>   File "<pyshell#14>", line 2, in <module>  "a()"
>   File "<pyshell#6>", line 2, in a        "b()"
>   File "<pyshell#9>", line 2, in b       "return tuple()[0]"

Put your code in a true module stored in a file, so the source lines can  
be retrieved.

-- 
Gabriel Genellina




More information about the Python-list mailing list