From d14f6cf7fb85e6fcccf146947c69418438a0f065 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Fri, 11 Sep 2020 16:51:04 +0200 Subject: [PATCH] Ignore wrong formatted row --- job_runner.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/job_runner.py b/job_runner.py index c015731b..1ba4631a 100644 --- a/job_runner.py +++ b/job_runner.py @@ -102,8 +102,12 @@ def handle_batch_import(batch_import: BatchImport): reader = csv.DictReader(lines) for row in reader: - full_alias = row["alias"].lower().strip().replace(" ", "") - note = row["note"] + try: + full_alias = row["alias"].lower().strip().replace(" ", "") + note = row["note"] + except KeyError: + LOG.warning("Cannot parse row %s", row) + continue alias_domain = get_email_domain_part(full_alias) custom_domain = CustomDomain.get_by(domain=alias_domain)