all Python 3sqlite3exception
sqlite3.InternalError
exceptions
Raised when SQLite encounters an internal error; a subclass of sqlite3.DatabaseError, it may indicate a problem with the runtime SQLite library.
Syntax
sqlite3.InternalError
You will not meet this in ordinary code: the engine is reporting that it found an inconsistency inside itself, which in practice means a corrupted database file or a broken SQLite build rather than a bad query. A dedicated except branch buys nothing — if it ever fires, inspect the file (PRAGMA integrity_check) and the engine build instead of rewriting your SQL.
Examples
import sqlite3
print(issubclass(sqlite3.InternalError, sqlite3.DatabaseError)) # → True
print(issubclass(sqlite3.InternalError, sqlite3.Error)) # → True
print(sqlite3.InternalError.__mro__[1].__name__) # → DatabaseError
try: raise sqlite3.InternalError('сбой внутри SQLite')
except sqlite3.DatabaseError as e: print(type(e).__name__) # → InternalError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy