[Tutor] global exception handling?

Che M pine508 at hotmail.com
Mon Aug 2 22:07:09 CEST 2010


A week or two back I asked this list about how to deal with SQLite database errors like 'database is locked'.  Since then I figured out one way to reproduce that error (*see p.s. below if anyone is interested).  I can also then catch the error with a try/except block and prevent it from causing problems.

But, the issue is, I have many places where I write to the database and would have to embed each of these in a try/except block.  I can do that, but wondered if there is a "global" way to catch this 'database is locked' error?  I found someone asking this sort of question online but it doesn't appear to be answered:
http://bytes.com/topic/python/answers/799486-how-do-i-prevent-exceptions-stopping-execution-global-exception-handler

Thanks,
Che

p.s. *I use the nice program SQLite Database Browser and if I edit a field in
 the database my Python app is accessing, click "Apply changes", but I do *not* save the changes (that is, I do not click the disk icon), when I go to write
 to that database from my Python app, I get a 'database is locked' error.

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100802/de229f67/attachment.html>


More information about the Tutor mailing list