J
J
JamesObry2021-02-05 16:46:04
Python
JamesObry, 2021-02-05 16:46:04

I get the error data base is locked, what should I do?

I want to check the database, but for some reason I get an error that it is closed

def newMessage_text():
    with sq.connect("vebinar.db") as con:
        cur = con.cursor()
        newMessage = cur.execute("select message_text from admin where telegram_id = '631914657' ")
        newMessage = cur.fetchone()[0]
        prevMessage = cur.execute("select prev_message_text from admin where telegram_id = '631914657' ")
        prevMessage = cur.fetchone()
        if prevMessage != newMessage:
            print('+')
            cur.execute(f"update admin set prev_message_text = '{newMessage}' where telegram_id = '631914657' ")
        elif prevMessage == newMessage:
            print('-')
        time.sleep(5)
        newMessage_text()
newMessage_text()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2021-02-05
@fox_12

The error data base is locked is falling, what to do

Use any other database - PostgeSQL, MySQL...

S
SashaN69, 2021-02-05
@SashaN69

Perhaps you have a database open in an application like SQLbrowser , and there is data that you forgot to save

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question