From 40c598cffd681fc8f54e95fe077a61c37be4ab8f Mon Sep 17 00:00:00 2001 From: Danilo Ferreira de Lima <danilo.enoque.ferreira.de.lima@xfel.de> Date: Wed, 30 Aug 2023 17:00:09 +0200 Subject: [PATCH] Bug fix reading data path: we have to avoid reading spaces and the comment character. --- src/calng/CrystfelRunner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calng/CrystfelRunner.py b/src/calng/CrystfelRunner.py index 04064293..15baa405 100644 --- a/src/calng/CrystfelRunner.py +++ b/src/calng/CrystfelRunner.py @@ -350,13 +350,15 @@ class CrystfelRunner(PythonDevice): self.KARABO_ON_INPUT("input", self.input_handler) # note: loading with cfelpyutils.geometry does not tell us peak_list value + # extra note: we need to avoid taking ';' and ' ' into the path! + # (Hence the large regexp on the right-hand side) self._geom_data_path = None self._geom_peak_path = None with open(self.get("crystfelArgs.geometryPath"), "rt") as fd: for line in fd: - if (match := re.match(r"data\s*=\s*(.*)$", line)): + if (match := re.match(r"data\s*=\s*([a-zA-Z0-9/\._]*)", line)): self._geom_data_path = match.group(1) - elif (match := re.match(r"peak_list\s*=\s*(.*)$", line)): + elif (match := re.match(r"peak_list\s*=\s*([a-zA-Z0-9/\._]*)", line)): self._geom_peak_path = match.group(1) if None not in (self._geom_data_path, self._geom_peak_path): break -- GitLab