Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:

> Could it instead throw a FileNotFoundError if the db simply doesn't exist at 
> the specified path?

We pass the database path pretty much straight to sqlite3_open_v2(), via the 
os.PathLike interface, so any errors we get come straight from SQLite (apart 
from os.PathLike errors). We translate SQLite error codes to the corresponding 
DP-API exception, as defined per PEP 249.

Raising FileNotFoundError would mean adding support for validating the path 
prior to calling sqlite3_open_v2() _and_ maintaining backwards compatibility 
(in-memory database, creating new database file if the path points to a valid 
directory, etc.). This will complicate the code unnecessary, IMO. I suggest to 
keep the current behaviour.

See also the slightly related bpo-24139.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45255>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to