how do i catch pywintypes.api_error?
John S. Yates, Jr.
john at yates-sheets.org
Fri Oct 5 09:23:32 EDT 2001
I can write
try:
...
except Exception, ex:
print type(ex)
print sys.exc_info()
...
and this does catch api_error:
<type 'instance'>
(<class pywintypes.api_error at 007C07FC>,
<pywintypes.api_error instance at 008A7724>,
<traceback object at 0089DB50>)
It also catches all exceptions derived from Python's
root Exception class. But when I write:
try:
...
except pywintypes.api_error, ex:
...
I get
AttributeError: 'pywintypes' module has no attribute 'api_error'
Is there anyway to write an except handler that will
catch only api_error? Alternatively, within a handler
can I determine whether or not I have an api_error?
/john
--
John Yates
40 Pine Street
Needham, MA 02492
781 444-2899
More information about the Python-list
mailing list