# HG changeset patch # User Nicolas Saunier # Date 1532118236 14400 # Node ID 8ab92ee3cbef70ab99f70a01be3f40a70fb532af # Parent 58994b08be423848c35f2f592bc2457f658e27d0 minor diff -r 58994b08be42 -r 8ab92ee3cbef scripts/process.py --- a/scripts/process.py Wed Jul 18 02:12:47 2018 -0400 +++ b/scripts/process.py Fri Jul 20 16:23:56 2018 -0400 @@ -110,7 +110,7 @@ ################################# # Report progress in the processing ################################# -if args.progress: +if args.progress: # TODO find video sequences that have null camera view, to work with them print('Providing information on data progress') headers = ['site', 'vs', 'features', 'objects', 'interactions'] # todo add prototypes and object classification data = [] diff -r 58994b08be42 -r 8ab92ee3cbef trafficintelligence/metadata.py --- a/trafficintelligence/metadata.py Wed Jul 18 02:12:47 2018 -0400 +++ b/trafficintelligence/metadata.py Fri Jul 20 16:23:56 2018 -0400 @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from pathlib import Path from os import path, listdir, sep from math import floor @@ -339,16 +340,24 @@ def createDatabase(filename): 'creates a session to query the filename' - engine = create_engine('sqlite:///'+filename) - Base.metadata.create_all(engine) - Session = sessionmaker(bind=engine) - return Session() + if Path(filename).is_file(): + engine = create_engine('sqlite:///'+filename) + Base.metadata.create_all(engine) + Session = sessionmaker(bind=engine) + return Session() + else: + print('The file '+filename+' does not exist') + return None def connectDatabase(filename): 'creates a session to query the filename' - engine = create_engine('sqlite:///'+filename) - Session = sessionmaker(bind=engine) - return Session() + if Path(filename).is_file(): + engine = create_engine('sqlite:///'+filename) + Session = sessionmaker(bind=engine) + return Session() + else: + print('The file '+filename+' does not exist') + return None def getSite(session, siteId = None, name = None, description = None): 'Returns the site(s) matching the index or the name'