[Tutor] What is in the traceback object
john.ertl at fnmoc.navy.mil
Tue Feb 8 19:42:27 CET 2005
That is great...every time I have a problem someone has already solved
it...the other problem is finding that solution...Thanks again.
From: Danny Yoo [mailto:dyoo at hkn.eecs.berkeley.edu]
Sent: Tuesday, February 08, 2005 10:39
To: Ertl, John
Cc: 'tutor at python.org'
Subject: Re: [Tutor] What is in the traceback object
On Tue, 8 Feb 2005, Ertl, John wrote:
> I have a bit of code that uses a module and I am trying to get more info
> on the error.
> I am using this bit of code:
> rhfill = Ngl.contour(wks,rhisobar,rh_res)
> execType,value,tracebak = sys.exc_info()[:3]
> print execType
> print value
> print tracebak
> In the log file I get this:
> error return without exception set
> <traceback object at 0xb6cf2c84>
> How do I get the actual traceback so I can read it?
You can use the 'traceback' module:
Use the traceback.print_exc() function within the except block: it'll
automatically pull information from sys.exc_info() for you:
rhfill = Ngl.contour(wks,rhisobar,rh_res)
Best of wishes to you!
More information about the Tutor