From fc9978b484b771f7edb7beac0a01ef6612bbd85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 17 Sep 2021 14:12:46 +0200 Subject: [PATCH] ignore lines not fitting the regex when parsing lines from .cnt file --- scripts/parse_counters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/parse_counters.py b/scripts/parse_counters.py index 01a7ce6..6dcf009 100755 --- a/scripts/parse_counters.py +++ b/scripts/parse_counters.py @@ -11,7 +11,10 @@ def parse_counters(filepath: Path, break_point: Dict) -> Dict: counters: Dict = {} with open(filepath) as f: for line in f: - counter, _, num = re.search(r"(.*): (\d*\.)*?(\d*)", line).groups() + match = re.search(r"(.*): (\d*\.)*?(\d+)", line) + if not match: + continue + counter, _, num = match.groups() num = int(num) if counter in break_point and num >= break_point[counter]: return counters