Supression du fichier src.csv (epxort) before start

This commit is contained in:
Ambulance Clerc
2022-03-12 19:00:01 +01:00
parent c298602685
commit d9dc17a27d
2 changed files with 5 additions and 0 deletions

Binary file not shown.

View File

@@ -369,6 +369,7 @@ class ClercAttrib2Biz():
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, f"src.csv")): if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, f"src.csv")):
os.remove(os.path.join(dest_dir, f"src.csv")) os.remove(os.path.join(dest_dir, f"src.csv"))
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
for filename in os.listdir(dir): for filename in os.listdir(dir):
@@ -682,6 +683,10 @@ class ClercAttrib2Biz():
wr = csv.writer(csv_file, delimiter=';') wr = csv.writer(csv_file, delimiter=';')
for cdr in lines: for cdr in lines:
wr.writerow(cdr) wr.writerow(cdr)
def reset_export_file(self):
if os.path.exists(os.path.join(dest_dir, f"src.csv")):
os.remove(os.path.join(dest_dir, f"src.csv"))
def open_export_file(self): def open_export_file(self):
print("RUN EXCEL with open") print("RUN EXCEL with open")
os.startfile(os.path.join(dest_dir, f"src.csv")) os.startfile(os.path.join(dest_dir, f"src.csv"))