How to fix database is locked error ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to fix database is locked error ?

When I do some stuff in my database in sqlite3 I get "OprtationalError: database is locked" how to fix it manually or automatically please ?

30th May 2020, 8:52 PM
Hisham YUM 🇲🇦
Hisham YUM 🇲🇦 - avatar
1 Answer
+ 1
You can try giving the program a longer timeout time to complete it's transaction, default is 5 seconds i believe; connection = sqlite.connect('cache.db', timeout=10)
30th May 2020, 8:59 PM