Skip to content

Commit 8c08172

Browse files
authored
Check if sep is in string
1 parent a35b086 commit 8c08172

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

pysurfex/binary_input.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,13 @@ def get_nml_value_from_string(nml, string, sep="#", indices=None):
335335
start = string.find("{")
336336
end = string.find("}")
337337
substring = string[start + 1 : end] if start >= 0 and end >= 0 else string
338-
nam_section = substring.split(sep)[0]
339-
nam_key = substring.split(sep)[1]
340-
value = InputDataFromNamelist.get_nml_value(
341-
nml, nam_section, nam_key, indices=indices
342-
)
338+
value = substring
339+
if substring.find(sep) > 0:
340+
nam_section = substring.split(sep)[0]
341+
nam_key = substring.split(sep)[1]
342+
value = InputDataFromNamelist.get_nml_value(
343+
nml, nam_section, nam_key, indices=indices
344+
)
343345
result = value
344346
if start >= 0 and end >= 0:
345347
result = string[: start + 1] + value + string[end:]

0 commit comments

Comments
 (0)