Correctly strip lines in read_cfl_file

This commit is contained in:
usov_i 2022-04-12 19:45:45 +02:00
parent 8d4f4a9b50
commit 6f1fe1a3d8

View File

@ -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)