RE: [Tutor] What is in the traceback object
Danny, That is great...every time I have a problem someone has already solved it...the other problem is finding that solution...Thanks again. John Ertl -Original Message- From: Danny Yoo [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 08, 2005 10:39 To: Ertl, John Cc: 'tutor@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: > > try: > rhfill= Ngl.contour(wks,rhisobar,rh_res) > except: > execType,value,tracebak = sys.exc_info()[:3] > print execType > print value > print tracebak > > In the log file I get this: > > exceptions.SystemError > error return without exception set > > > How do I get the actual traceback so I can read it? Hi John, You can use the 'traceback' module: http://www.python.org/doc/lib/module-traceback.html Use the traceback.print_exc() function within the except block: it'll automatically pull information from sys.exc_info() for you: ## try: rhfill= Ngl.contour(wks,rhisobar,rh_res) except: traceback.print_exc() ## Best of wishes to you! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
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: > > try: > rhfill= Ngl.contour(wks,rhisobar,rh_res) > except: > execType,value,tracebak = sys.exc_info()[:3] > print execType > print value > print tracebak > > In the log file I get this: > > exceptions.SystemError > error return without exception set > > > How do I get the actual traceback so I can read it? Hi John, You can use the 'traceback' module: http://www.python.org/doc/lib/module-traceback.html Use the traceback.print_exc() function within the except block: it'll automatically pull information from sys.exc_info() for you: ## try: rhfill= Ngl.contour(wks,rhisobar,rh_res) except: traceback.print_exc() ## Best of wishes to you! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] What is in the traceback object
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: try: rhfill = Ngl.contour(wks,rhisobar,rh_res) except: execType,value,tracebak = sys.exc_info()[:3] print execType print value print tracebak In the log file I get this: exceptions.SystemError error return without exception set How do I get the actual traceback so I can read it? Thanks, John Ertl ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor