From 6f1fe1a3d8bd1c1539d203cb89e705aa2b479ce0 Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Tue, 12 Apr 2022 19:45:45 +0200 Subject: [PATCH] Correctly strip lines in read_cfl_file --- pyzebra/sxtal_refgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyzebra/sxtal_refgen.py b/pyzebra/sxtal_refgen.py index 455743c..24e343a 100644 --- a/pyzebra/sxtal_refgen.py +++ b/pyzebra/sxtal_refgen.py @@ -170,6 +170,7 @@ def read_cfl_file(fileobj): params = {"SPGR": None, "CELL": None, "WAVE": None, "UBMAT": None, "HLIM": None, "SRANG": None} param_names = tuple(params) for line in fileobj: + line = line.strip() if "!" in line: # remove comments that start with ! sign line, _ = line.split(sep="!", maxsplit=1) @@ -177,7 +178,7 @@ def read_cfl_file(fileobj): if line.startswith("UBMAT"): # next 3 lines contain the matrix param, val = "UBMAT", [] for _ in range(3): - next_line = next(fileobj) + next_line = next(fileobj).strip() val.extend(next_line.split(maxsplit=2)) else: param, val = line.split(maxsplit=1)