From 2b5ce1cf042b348ea4fedc681b3a936b5c641288 Mon Sep 17 00:00:00 2001 From: shrlnm Date: Sat, 5 Nov 2022 08:16:46 +0300 Subject: [PATCH] Fix for convert_db.py #3 --- pyren3/convert_db.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyren3/convert_db.py b/pyren3/convert_db.py index 5432a56..d59c20f 100755 --- a/pyren3/convert_db.py +++ b/pyren3/convert_db.py @@ -19,6 +19,9 @@ if __name__ == "__main__": if not os.path.exists('./cache'): os.makedirs('./cache') + + if os.path.exists('pyrendata.zip'): + os.remove('pyrendata.zip') mod_db_manager.find_DBs() @@ -74,13 +77,13 @@ if __name__ == "__main__": try: while len(vf) and vf[0] in ['.', '/', '\\']: vf = vf[1:] - optf = optfile (vf) + optf = optfile (vf, cache=False) except: print("Skipping file ", vf) continue data = pickle.dumps (optf.dict) 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: vf = vf[:-4] + vf[-4:].lower() @@ -88,13 +91,13 @@ if __name__ == "__main__": try: while len(vf) and vf[0] in ['.', '/', '\\']: vf = vf[1:] - optf = optfile (vf) + optf = optfile (vf, cache=False) except: print("Skipping file ", vf) continue data = pickle.dumps (optf.dict) 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: zf.write (zipoutput.getvalue ())