comparison python/storage.py @ 1004:75601be6019f

work on process
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 03 Jun 2018 00:21:18 -0400
parents 75af46516b2b
children 16932cefabc1
comparison
equal deleted inserted replaced
1003:75af46516b2b 1004:75601be6019f
964 "CREATE TABLE IF NOT EXISTS curvilinear_positions (t REAL, trajectory_id INTEGER, link_id INTEGER, lane_id INTEGER, s_coordinate REAL, y_coordinate REAL, speed REAL, PRIMARY KEY (t, trajectory_id));\n"+ 964 "CREATE TABLE IF NOT EXISTS curvilinear_positions (t REAL, trajectory_id INTEGER, link_id INTEGER, lane_id INTEGER, s_coordinate REAL, y_coordinate REAL, speed REAL, PRIMARY KEY (t, trajectory_id));\n"+
965 ".import "+filename+" curvilinear_positions\n"+ 965 ".import "+filename+" curvilinear_positions\n"+
966 "DELETE FROM curvilinear_positions WHERE trajectory_id IS NULL OR trajectory_id = \"NO\";\n") 966 "DELETE FROM curvilinear_positions WHERE trajectory_id IS NULL OR trajectory_id = \"NO\";\n")
967 out.close() 967 out.close()
968 # system call 968 # system call
969 from subprocess import check_call 969 from subprocess import run
970 out = openCheck("err.log", "w") 970 out = openCheck("err.log", "w")
971 check_call("sqlite3 "+utils.removeExtension(filename)+".sqlite < "+sqlScriptFilename, stderr = out, shell = True) 971 run("sqlite3 "+utils.removeExtension(filename)+".sqlite < "+sqlScriptFilename, stderr = out)
972 out.close() 972 out.close()
973 shutil.os.remove(sqlScriptFilename) 973 shutil.os.remove(sqlScriptFilename)
974 974
975 def loadObjectNumbersInLinkFromVissimFile(filename, linkIds): 975 def loadObjectNumbersInLinkFromVissimFile(filename, linkIds):
976 '''Finds the ids of the objects that go through any of the link in the list linkIds''' 976 '''Finds the ids of the objects that go through any of the link in the list linkIds'''