# HG changeset patch # User Etienne Beauchamp # Date 1587050675 14400 # Node ID 3e0f43edb4d6320ac305ad564987cd2d1c99c34f # Parent 78dddfe7aa0f59e4b387196ad4b88bbcc972b61c Issue loading from different location diff -r 78dddfe7aa0f -r 3e0f43edb4d6 trafficintelligence/storage.py --- a/trafficintelligence/storage.py Wed Apr 15 00:18:35 2020 -0400 +++ b/trafficintelligence/storage.py Thu Apr 16 11:24:35 2020 -0400 @@ -6,6 +6,7 @@ import shutil from copy import copy import sqlite3, logging +from os import chdir from numpy import log, min as npmin, max as npmax, round as npround, array, sum as npsum, loadtxt, floor as npfloor, ceil as npceil, linalg, int32, int64 from pandas import read_csv, merge @@ -661,6 +662,9 @@ 'Loads prototype ids and matchings (if stored)' prototypes = [] if Path(filename).is_file(): + filename = str(Path(filename).resolve()) + pwd = Path.cwd() + chdir(Path(filename).parent) with sqlite3.connect(filename) as connection: cursor = connection.cursor() objects = [] @@ -685,6 +689,7 @@ printDBError(error) if len(set([p.getTrajectoryType() for p in prototypes])) > 1: print('Different types of prototypes in database ({}).'.format(set([p.getTrajectoryType() for p in prototypes]))) + chdir(pwd) return prototypes def savePOIsToSqlite(filename, gmm, gmmType, gmmId):