Имею скрипт телеграм бота.
Когда человек доходит до этапа покупки, бот падает с ошибкой "Database is locked ".
Бот падает на последней строке (connection.commit()).
connection = sqlite3.connect('database.sqlite')
q = connection.cursor()
bot.delete_message(chat_id=call.message.chat.id,message_id=call.message.message_id)
q.execute("SELECT name FROM tovar where id = "+ str(call.data[4:]))
aaaaa = q.fetchone()
if aaaaa != None:
q.execute("SELECT balans FROM ugc_users where id = "+ str(call.from_user.id))
bal_us = q.fetchone()
q.execute("SELECT price FROM tovar where id = "+ str(call.data[4:]))
price_tovar = q.fetchone()
if int(bal_us[0]) >= int(price_tovar[0]):
q.execute("update ugc_users set balans = balans - " + str(price_tovar[0])+" where id = " +str(call.from_user.id))
connection.commit()