diff --git a/datasette/app.py b/datasette/app.py index 98a31364..34300272 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -227,7 +227,7 @@ class Datasette: self.databases.pop(name) def scan_dirs(self): - # Recurse through self.dirs looking for new SQLite DBs + # Recurse through self.dirs looking for new SQLite DBs. Runs in a thread. while True: current_filepaths = { d.path for d in list(self.databases.values()) if d.path is not None diff --git a/datasette/utils/__init__.py b/datasette/utils/__init__.py index c15b7eae..f0a2cb89 100644 --- a/datasette/utils/__init__.py +++ b/datasette/utils/__init__.py @@ -603,7 +603,8 @@ def is_valid_sqlite(path): return False # Check we can run `select * from sqlite_master` try: - sqlite3.connect(str(path)).execute("select * from sqlite_master") + conn = sqlite3.connect(str(path)) + check_connection(conn) except Exception: return False return True