From a1383da9b3828cea5ba9c6700839a5494f4d4e60 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Mon, 16 Feb 2015 10:31:21 +0100 Subject: [PATCH] LocalStatusSQLite: provide information on what is failing for OperationalError Signed-off-by: Nicolas Sebrecht --- offlineimap/folder/LocalStatusSQLite.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/offlineimap/folder/LocalStatusSQLite.py b/offlineimap/folder/LocalStatusSQLite.py index f54ba99..bcce8ec 100644 --- a/offlineimap/folder/LocalStatusSQLite.py +++ b/offlineimap/folder/LocalStatusSQLite.py @@ -66,10 +66,16 @@ class LocalStatusSQLiteFolder(BaseFolder): try: self.connection = sqlite.connect(self.filename, check_same_thread=False) except NameError: - # sqlite import had failed + # sqlite import had failed. raise UserWarning("SQLite backend chosen, but cannot connect " "with available bindings to '%s'. Is the sqlite3 package " "installed?."% self.filename), None, exc_info()[2] + except sqlite.OperationalError as e: + # Operation had failed. + raise UserWarning("cannot open database file '%s': %s.\nYou might " + "want to check the rights to that file and if it cleanly opens " + "with the 'sqlite<3>' command."% + (self.filename, e)), None, exc_info()[2] # Make sure sqlite is in multithreading SERIALIZE mode. assert sqlite.threadsafety == 1, 'Your sqlite is not multithreading safe.'