From 83943d373481c57c224f18cd5769a7087ee433f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ducceschi?= Date: Wed, 11 Jan 2017 15:36:02 +0100 Subject: [PATCH] FIX creation of database - first time you run the automation-tools, the database file need to be created --- transfers/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/transfers/models.py b/transfers/models.py index 55b9b9ae..f1cc53be 100644 --- a/transfers/models.py +++ b/transfers/models.py @@ -1,3 +1,5 @@ +from os.path import isfile + from sqlalchemy import create_engine from sqlalchemy import Sequence from sqlalchemy import Column, Binary, Boolean, Integer, String @@ -22,6 +24,10 @@ def __repr__(self): def init(databasefile): + if not isfile(databasefile): + # We create the file + with open(databasefile, "a"): + pass engine = create_engine('sqlite:///{}'.format(databasefile), echo=False) global Session Session = sessionmaker(bind=engine)