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

BigHand heweiwei at gmail.com
Sat Mar 7 18:18:22 EST 2009


On 3月7日, 下午11时21分, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Sat, 07 Mar 2009 11:46:08 -0200, BigHand <hewei... 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_ex...
>
> > 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

hello,Gabriel,
    I don't understand you.could you give me more details?
http://docs.python.org/3.0/library/traceback.html?highlight=format_exception#traceback.format_exception
the up page is from python 3.0's doc. maybe from a older version of
Python,

even I excute these file in a py script file, it's can't retrieve the
source line either.




More information about the Python-list mailing list