I am trying to run an UPDATE query but I keep getting a database locked error. I don't have another thread that is constantly writing, so I don't think that is the problem. I am also closing the connection to the database when ever I am done running the queries in another function. I haven't gotten this error with any of the other queries except for this one.
x = sqlite3.connect("database.db")
c = x.cursor()
c.execute("UPDATE character SET section=? WHERE username=?", ('town','%'+self.username+'%'))
x.commit()
I have tried it sever different ways, such as:
x = sqlite3.connect("database.db")
c = x.cursor()
c.execute("UPDATE character SET section='town' WHERE username=?", [self.username])
Thanks for your help. x.commit()