I have written the following code, which is showing the sqlite3.OperationalError: database is locked
error. Any help to debug would be much appreciated.
I'm not sure if this will help anyone, but I figured out a solution to my own Locked Database problem.
I use PyCharm and found that several instances of the script I was working on were all running. This was usually due to errors in the code I was testing, but it stayed active (and therefore the connection to the db was still active). Close out of those (stop all the processes) and try again - it has worked every time for me!
If anyone knows a way to make it timeout after a little while, please comment this solution. I tried cur.execute("PRAGMA busy_timeout = 30000")
(found from another thread on a similar question) but it didn't seem to do anything.