# HG changeset patch # User Nicolas Saunier # Date 1532118270 14400 # Node ID b123fa0e544073b345537aa114b47dc9eb8d61d8 # Parent 8ab92ee3cbef70ab99f70a01be3f40a70fb532af# Parent c67f8c36ebc754b8841191c5dd4fbd8f7ed25198 merged diff -r c67f8c36ebc7 -r b123fa0e5440 scripts/process.py --- a/scripts/process.py Thu Jul 19 01:44:11 2018 -0400 +++ b/scripts/process.py Fri Jul 20 16:24:30 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 c67f8c36ebc7 -r b123fa0e5440 trafficintelligence/metadata.py --- a/trafficintelligence/metadata.py Thu Jul 19 01:44:11 2018 -0400 +++ b/trafficintelligence/metadata.py Fri Jul 20 16:24:30 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'