mxODBC and exceptions

Paul Boddie paul at boddie.net
Wed Sep 12 12:49:34 EDT 2001


Mikael Lexén <lexen at telia.com> wrote in message news:<3B9F14DD.3B9CC835 at telia.com>...
> Hi
> 
> I'm using the mxODBC module and I have problem getting the exception
> clause to work.
> I do the following:
> 
> import mx.ODBC
> 
> <code>
> 
> try:
>   c.executedirect(Sql)
> 
> #except mxODBC.IntegrityError:

Did you mean mx.ODBC.IntegrityError here?

> #except IntegrityError:
> except:
>    print "Unexpected error:", sys.exc_info()[0]
>    raise

[...]

> I have tried different exception clause as you can see but it doesn't
> work. What am I doing wrong?

You might want to import mx.ODBC in the interactive interpreter (for
convenience) and then inspect the package's different namespaces,
using statements such as...

  dir(mx.ODBC)

I'm sure it's there somewhere!

Paul



More information about the Python-list mailing list