Bladeren bron

Fehler, falls versand.csv zusätzliche Leerzeilen enthält

gc-server3 5 maanden geleden
bovenliggende
commit
40f2a2d170
1 gewijzigde bestanden met toevoegingen van 18 en 10 verwijderingen
  1. 18 10
      cognos11/c11_export.py

+ 18 - 10
cognos11/c11_export.py

@@ -1,12 +1,13 @@
-from collections import defaultdict
-from pathlib import Path
-from cognos11.c11_api import c11_api
-import config
 import json
 import logging
 import os
-from datetime import datetime
+from collections import defaultdict
 from dataclasses import dataclass
+from datetime import datetime
+from pathlib import Path
+
+import config
+from cognos11.c11_api import c11_api
 
 
 @dataclass
@@ -156,12 +157,19 @@ class c11_export:
         required_full_export = []
         with open(Path(mail_csv), "r", encoding="latin-1") as rfh:
             for row in rfh.readlines():
+                if ";" not in row:
+                    continue
                 filename, mailto = row.split(";")
-                if "@" in mailto:
-                    required_files.append(str(Path(self.cfg.cognos11.reportoutput_dir + '/' + filename).resolve()))
-                    if "_Schichten." in filename:
-                        filename2 = filename.replace("__Summe_und_Schichten", "__Summe").replace("__nur_Schichten", "__Summe")
-                        required_full_export.append(str(Path(self.cfg.cognos11.reportoutput_dir + '/' + filename2).resolve()))
+                if "@" not in mailto:
+                    continue
+                required_files.append(str(Path(self.cfg.cognos11.reportoutput_dir + "/" + filename).resolve()))
+                if "_Schichten." in filename:
+                    filename2 = filename.replace("__Summe_und_Schichten", "__Summe").replace(
+                        "__nur_Schichten", "__Summe"
+                    )
+                    required_full_export.append(
+                        str(Path(self.cfg.cognos11.reportoutput_dir + "/" + filename2).resolve())
+                    )
         res = []
         for req_group in req_plan:
             if len(req_group) > 0 and str(Path(req_group[0].filename).resolve()) in required_full_export: