From 4eed41cac5f6b8434ca8a4100b04cac9fbd22f68 Mon Sep 17 00:00:00 2001 From: David Schaefer <david.schaefe@gmail.com> Date: Thu, 9 Jan 2020 21:33:00 +0100 Subject: [PATCH] allow missing keys in configuration rows --- saqc/core/reader.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/saqc/core/reader.py b/saqc/core/reader.py index 5dba2d2d9..82ac5fa21 100644 --- a/saqc/core/reader.py +++ b/saqc/core/reader.py @@ -62,11 +62,16 @@ def _castRow(row: Dict[str, str]) -> Dict[str, Any]: out = {} keys = pd.Index(row.keys()) for k, func in CONFIG_TYPES.items(): - key = keys[keys.str.match(k)][0] + try: + key = keys[keys.str.match(k)][0] + except IndexError: + continue value = row[key] + # NOTE: + # this check and the raise should be moved to checkConfig try: out[key] = func(value) - except: + except ValueError: _raise(row, ValueError, f"invalid value: '{value}'") return out -- GitLab