[Tutor] SQLite error messages
Alan Harris-Reid
aharrisreid at googlemail.com
Wed Mar 10 03:37:13 CET 2010
Hi there,
I am using the sqlite3 module with Python 3.1, and have some code which
goes something like as follows...
import sqlite3
con = sqlite3.connect('MyDatabase.db')
try:
execresult = con.execute('INSERT INTO MyTable (field_name) VALUES
("MyValue")')
con.commit()
except:
con.rollback()
If con.execute() fails, nothing is returned, and although the code
correctly executes the rollback next, I have no idea why, and therefore
cannot create a suitable error-handler with meaningful messages.
I notice from the SQLite website that there are error codes, but it
looks like the sqlite3 module is not reporting them.
Has anyone any ideas how to get around this problem?
TIA,
Alan Harris-Reid
More information about the Tutor
mailing list