Sqlite python sqlite3.OperationalError: database is locked

前端 未结 4 1086
野的像风
野的像风 2020-12-17 17:45

I have written the following code, which is showing the sqlite3.OperationalError: database is locked error. Any help to debug would be much appreciated.

4条回答
  •  星月不相逢
    2020-12-17 18:18

    cursor2 = conn.cursor()
    cursor3 = conn.cursor()
    cursor4 = conn.cursor()
    

    I think you have to close the connection which you have opened,may be the error is because of that cause you have opened multiple connections.

    cursor2 = conn.cursor()
    """EDIT YOUR DATABASE USING CODE AND CLOSE THE CONNECTION"""
    connection.close()
    
    cursor3 = conn.cursor()
    """EDIT YOUR DATABASE USING CODE AND CLOSE THE CONNECTION"""
    connection.close()
    
    cursor4 = conn.cursor()
    """EDIT YOUR DATABASE USING CODE AND CLOSE THE CONNECTION"""
    connection.close()
    

提交回复
热议问题