From 66fb58148dbd4510096a5fdd8791463ba1a4ac01 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Wed, 16 Feb 2022 18:57:39 +0100 Subject: [PATCH] made SqlFile cope with older versions of python that don't like Path type as arguments to open --- cocluto/SimpaDbUtil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocluto/SimpaDbUtil.py b/cocluto/SimpaDbUtil.py index d5f11c5..c3772db 100644 --- a/cocluto/SimpaDbUtil.py +++ b/cocluto/SimpaDbUtil.py @@ -95,7 +95,7 @@ class SqlFile(ISqlDatabaseBackend): # If set False, the returned connection may be shared across multiple threads. When using multiple threads with the same connection writing operations should be serialized by the user to avoid data corruption # I hope it's safe here but I'm not 100% sure though. Anyway, if the database gets corrupt, it not a big deal since this memory resident database gets reconstructed from the sql file... self._con = sqlite3.connect(sqlite_db_path, check_same_thread=check_same_thread) - with open(self._sql_file_path, 'r') as f: + with open(str(self._sql_file_path), 'r') as f: # str conversion has been added to support older versions of python in which open don't accept arguments of type Path sql = f.read() # watch out for built-in `str` # print(sql) self._cur = self._con.cursor()