On 01/10/2013 04:16, Alex Kleider wrote:
try:
cur.execute("COMMIT;")
except:
pass
And the problem = \
"""
If the 'cur.execute("COMMIT;")' statement is left by itself, outside of a
"try/except" clause, I get an error with the following trace back:
"
Traceback (most recent call last):
File "./uwomeds68.py", line 119, in <module>
go_on.insert()
File "./uwomeds68.py", line 64, in insert
cur.execute("COMMIT;")
sqlite3.OperationalError: cannot commit - no transaction is active
"
As you've already had some sound advice I'd just like to point out that
a bare except is considered bad form, e.g. it would mask any attempt to
use CTRL-C to halt a rouge program that's inadvertantly gone into an
infinite loop. An obvious one to use here could be the given
sqlite3.OperationalError. Common problems that are caught include
NameError, IndexError and ScrewedUpCompletelyError :)
--
Cheers.
Mark Lawrence
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor