Python SQLite: database is locked

后端 未结 20 1217
一生所求
一生所求 2020-12-12 14:24

I\'m trying this code:

import sqlite

connection = sqlite.connect(\'cache.db\')
cur = connection.cursor()
cur.execute(\'\'\'create table item
  (id integer p         


        
20条回答
  •  难免孤独
    2020-12-12 14:52

    I had this problem while working with Pycharm and with a database that was originally given to me by another user.

    So, this is how I solve it in my case:

    1. Closed all tabs in Pycharm that operate with the problematic database.
    2. Stop all running processes from the red square botton in the top right corner of Pycharm.
    3. Delete the problematic database from the directory.
    4. Upload again the original database. And it worked again.

提交回复
热议问题