pamhyr: Close study DB if already init.

setup.py
Pierre-Antoine Rouby 2024-03-22 14:03:46 +01:00
parent 334ada3dcc
commit 0f25334032
1 changed files with 3 additions and 1 deletions

View File

@ -35,8 +35,10 @@ class SQLModel(SQL):
_sub_classes = []
def _init_db_file(self, db, is_new=True):
exists = Path(db).exists()
if self._db is not None:
self._db.close()
exists = Path(db).exists()
if exists and is_new:
os.remove(db)