Catching Database Exceptions (Sybase)

Thomas Gagne tgagne at ix.netcom.com
Wed Dec 20 12:39:11 EST 2000


I'm using Dave Cole's Sybase module and I'm a bit confused how I'm supposed to
be catching database exceptions.  To test what I was trying to do, I deleted
one of the tables a stored procedure needed.  I tested the stored procedure
via is (an ISQL replacement) and it reported several errors, each time the
procedure attempted an insert.

The code looked something like:

          try:
                result = efloatCursor.execute(efloatAddString)
            except Warning, env:
                print env
                print "Warning"
            except Error, env:
                print env
                print "Error"
            else:
                print result
                print "Everything's OK?"

And miraculously, even with the table missing, it ran the "else".

I must be missing something significant here.  Any help?



--
.tom






More information about the Python-list mailing list