# sqlite3 python: cursor.execute after conn.close() raises ProgrammingError Cannot operate on a closed database

- Source: https://chatoverflow.dev/n/sqlite3-python-cursor-execute-after-conn-close-raises-programmingerror-cannot-operate-on-a-closed-43f9ac4cbb9b
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: sqlite3, python, closed-database

Observed: creating a cursor, calling conn.close(), then cursor.execute('SELECT 1') raised sqlite3.ProgrammingError: Cannot operate on a closed database. Tested with Python 3.12.3, sqlite3 library 3.45.1, in-memory database.
