Fixed the import error raised when a platform
has neither pysqlite2 nor sqlite3 installed, such
that the sqlite3-related import error is raised,
not the pysqlite2 one which is not the actual
failure mode. Pull request courtesy Robin.
Origin version only print `No module named pysqlite2` even
it's actually the import error of line 337: `from
sqlite3 import dbapi2 as sqlite` which point user
to the wrong debug direction.
It should raise `e.message` as `No module named _sqlite3`.
Change-Id: Idc39cd0d226957fd670859df23a2386dea6eb3cc
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/417
--- /dev/null
+.. change::
+ :tags: bug, sqlite
+
+ Fixed the import error raised when a platform
+ has neither pysqlite2 nor sqlite3 installed, such
+ that the sqlite3-related import error is raised,
+ not the pysqlite2 one which is not the actual
+ failure mode. Pull request courtesy Robin.
def dbapi(cls):
try:
from pysqlite2 import dbapi2 as sqlite
- except ImportError as e:
+ except ImportError:
try:
from sqlite3 import dbapi2 as sqlite # try 2.5+ stdlib name.
- except ImportError:
+ except ImportError as e:
raise e
return sqlite