mxODBC error trapping
markx.daley at intel.com
Tue Apr 25 23:02:46 CEST 2000
>>Daley, MarkX <markx.daley at intel.com> wrote:
>> I am accessing databases using the notes by John Dell'Aquila for ODBC
>> Python Database API. It works fine, but now I am trying to set up error
>> trapping in the event that a connection fails to be made. Here is the
>> code structure:
>> def collect():
>> "Routine to query all servers for all names for time period defined
>> in timer."
>> # Define some variables
>> for index in servername:
>> # Big routine to collect data and write to file
>> except dbi.operation-error:
>"operation-error" is not a valid name (it's interpreted
>as "operation" minus "error").
>> I guess I don't know enough about exceptions to trap them properly. Any
>according to the DB specification , OperationalError is the
>correct name. you still have to qualify it with the module name,
> except dbi.OperationalError:
>if that doesn't work, try printing the contents of the "dbi" module:
When I use dbi.OperationalError, I get this result:
Traceback (innermost last):
File "<pyshell#1>", line 1, in ?
File "C:\PROGRA~1\Python\collect.py", line 50, in collect
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']
I am way out of my depth here. Any and all help is appreciated.
More information about the Python-list