@kerosin1323

Cannot operate on a closed database Не понимаю в чем ошибка sqlite3?

c.execute('INSERT INTO carters_data (price, insurance) VALUES (?)', (rub_price, 'Да'))
db.commit()

Ошибка:
Task exception was never retrieved
future: <Task finished name='Task-19' coro=<Dispatcher._process_polling_updates() done, defined at C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py:407> exception=ProgrammingError('Cannot operate on a closed database.')>
Traceback (most recent call last):
  File "C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
    return await asyncio.gather(*tasks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 256, in process_update
    return await self.message_handlers.notify(update.message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Юля\PycharmProjects\pythonProject4\venv\Lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Юля\PycharmProjects\pythonProject4\main.py", line 223, in total_price
    c.execute('INSERT INTO carters_data (price, insurance) VALUES (?)', (rub_price, 'Да'))
sqlite3.ProgrammingError: Cannot operate on a closed database.
  • Вопрос задан
  • 265 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы