Fix for convert_db.py #3
This commit is contained in:
parent
13e33d1558
commit
2b5ce1cf04
@ -20,6 +20,9 @@ if __name__ == "__main__":
|
|||||||
if not os.path.exists('./cache'):
|
if not os.path.exists('./cache'):
|
||||||
os.makedirs('./cache')
|
os.makedirs('./cache')
|
||||||
|
|
||||||
|
if os.path.exists('pyrendata.zip'):
|
||||||
|
os.remove('pyrendata.zip')
|
||||||
|
|
||||||
mod_db_manager.find_DBs()
|
mod_db_manager.find_DBs()
|
||||||
|
|
||||||
inputpath = sys.argv[1]
|
inputpath = sys.argv[1]
|
||||||
@ -74,13 +77,13 @@ if __name__ == "__main__":
|
|||||||
try:
|
try:
|
||||||
while len(vf) and vf[0] in ['.', '/', '\\']:
|
while len(vf) and vf[0] in ['.', '/', '\\']:
|
||||||
vf = vf[1:]
|
vf = vf[1:]
|
||||||
optf = optfile (vf)
|
optf = optfile (vf, cache=False)
|
||||||
except:
|
except:
|
||||||
print("Skipping file ", vf)
|
print("Skipping file ", vf)
|
||||||
continue
|
continue
|
||||||
data = pickle.dumps (optf.dict)
|
data = pickle.dumps (optf.dict)
|
||||||
zf.writestr (os.path.join ("Location",
|
zf.writestr (os.path.join ("Location",
|
||||||
os.path.basename (vf).replace (".bqm", ".p")), str (data))
|
os.path.basename (vf).replace (".bqm", ".p")), data)
|
||||||
|
|
||||||
for vf in fgsessionfiles:
|
for vf in fgsessionfiles:
|
||||||
vf = vf[:-4] + vf[-4:].lower()
|
vf = vf[:-4] + vf[-4:].lower()
|
||||||
@ -88,13 +91,13 @@ if __name__ == "__main__":
|
|||||||
try:
|
try:
|
||||||
while len(vf) and vf[0] in ['.', '/', '\\']:
|
while len(vf) and vf[0] in ['.', '/', '\\']:
|
||||||
vf = vf[1:]
|
vf = vf[1:]
|
||||||
optf = optfile (vf)
|
optf = optfile (vf, cache=False)
|
||||||
except:
|
except:
|
||||||
print("Skipping file ", vf)
|
print("Skipping file ", vf)
|
||||||
continue
|
continue
|
||||||
data = pickle.dumps (optf.dict)
|
data = pickle.dumps (optf.dict)
|
||||||
zf.writestr (os.path.join ("EcuRenault", "Sessions",
|
zf.writestr (os.path.join ("EcuRenault", "Sessions",
|
||||||
os.path.basename (vf).replace ("FG", "UG").replace (".xml", ".p")), str (data))
|
os.path.basename (vf).replace ("FG", "UG").replace (".xml", ".p")), data)
|
||||||
|
|
||||||
with open ("pyrendata.zip", "wb") as zf:
|
with open ("pyrendata.zip", "wb") as zf:
|
||||||
zf.write (zipoutput.getvalue ())
|
zf.write (zipoutput.getvalue ())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user