From 4101671f4220c5b59c93e1ace7b9bae4cb6d789b Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 26 Feb 2012 21:37:37 +0100 Subject: [PATCH] Do not initialize multiple times --- couchpotato/runner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/couchpotato/runner.py b/couchpotato/runner.py index ef56462b..11236c16 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -130,7 +130,9 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En # Load migrations initialize = True db = Env.get('db_path') - if os.path.isfile(db): + if os.path.isfile(db.replace('sqlite:///', '')): + initialize = False + from migrate.versioning.api import version_control, db_version, version, upgrade repo = os.path.join(base_path, 'couchpotato', 'core', 'migration') logging.getLogger('migrate').setLevel(logging.WARNING) # Disable logging for migration @@ -138,7 +140,6 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En latest_db_version = version(repo) try: current_db_version = db_version(db, repo) - initialize = False except: version_control(db, repo, version = latest_db_version) current_db_version = db_version(db, repo)