I am using Python 3 and sqlite3 on Windows. I am developing a small application that is using a database to store contacts. I notice that if the application closes forcibly (either by error or ending via task manager) that I get the sqlite3 error (sqlite3.OperationalError: database is locked).
I imagine this is because I am not properly closing the database connection before the application has closed. I have tried this:
connection = sqlite3.connect(dbFile.db)
connection.commit()
connection.close()
and then trying to reopen the connection, but the locked database remains. Is there anyway to close the database before a crash? Or a way to unlock the database in the application? Right now the only solution I have is to delete the database and start over (which will not really work long term).
Thanks!