mxODBC error trapping

Joshua Macy amused at webamused.com
Tue Apr 25 22:00:08 EDT 2000


"Daley, MarkX" wrote:
> 
>
> Traceback (innermost last):
>   File "<pyshell#1>", line 1, in ?
>     collect.collect()
>   File "C:\PROGRA~1\Python\collect.py", line 50, in collect
>     except dbi.OperationalError:
> AttributeError: OperationalError
> 
> Here is the printout of the dbi module:
> 
> ['DATE', 'NUMBER', 'RAW', 'ROWID', 'STRING', 'TYPES', '__doc__', '__file__',
> '__name__', 'dataError', 'dbDate', 'dbRaw', 'dbiDate', 'dbiRaw',
> 'integrityError', 'internalError', 'noError', 'opError', 'progError']
> 
>


  According to the dbi module dictionary (which you've printed), it
looks like it should be opError, not OperationalError.  Or you could
just use an unqualified except, and be sure of catching any error that
the dbi can raise.

 Joshua



More information about the Python-list mailing list