[Zope] Accessing sys.exc_info() from python script

Jim Cain jcain at equala.com
Mon Jun 7 15:35:10 EDT 2004


I need access to error info inside of an except in a Python script. How 
do I get that?

Specifically, I'm executing an Oracle stored procedure, and if I catch 
an exception, I want to include the error message in the return value. 
Here's a greatly simplified example using sys.exc_info if I could 
actually import and use it:

import sys
try:
   context.my_proc
   print 'OK'
except:
   print 'Error: ' + sys.exc_info()[1]
return printed

Is there a Zope-ish way to access the info returned by exc_info()?

Thanks,
Jim



More information about the Zope mailing list