On 10 March 2010 21:02, Alan Harris-Reid <aharrisr...@googlemail.com> wrote: > Maybe I have misunderstood you, but I always thought that the 'finally' > section was run even if the 'try' section is successful, in which case I > would not want a rollback.
I was thinking something like this. import sqlite3 con = sqlite3.connect('MyDatabase.db') execresult = None try: execresult = con.execute('INSERT INTO MyTable (field_name) VALUES ("MyValue")') con.commit() finally: if not execresult: print 'Rollback' con.rollback() This way you can have a rollback and still see an exception. Greets Sander _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor