Skip to content

Commit 6c5a88e

Browse files
committed
Fix grid name parsing
If passed with quotation marks, these are stripped in BOUT++ but not here, causing issues on load
1 parent 11f5d0a commit 6c5a88e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/boutdata/data.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,12 @@ def count_brackets(s):
743743
# Try to convert to float
744744
value = float(value)
745745
except ValueError:
746-
# Leave as a string
747-
pass
746+
# Leave as a string, stripping surrounding quotes
747+
if len(value) >= 2 and (
748+
(value[0] == '"' and value[-1] == '"')
749+
or (value[0] == "'" and value[-1] == "'")
750+
):
751+
value = value[1:-1]
748752

749753
value_name = line[:eqpos].strip()
750754
section[value_name] = value

0 commit comments

Comments
 (0)