Skip to content

Commit

Permalink
Make make_indexjson more robust (#389)
Browse files Browse the repository at this point in the history
Didn't handle single quotes gracefully and ran into some encoding issue
on ACC.
  • Loading branch information
lbam authored Aug 15, 2023
1 parent f2cd3fa commit 38631e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/make_indexjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def parse_mapfile(filename: str) -> Tuple[str, Dict[str, object]]:
# mapfiles would be cleaner, but mappyfile doesn't support the full mapfile
# grammar, so we'd need this as a fallback anyway.
r = {}
with open(filename) as f:
with open(filename, encoding="utf-8") as f:
for ln in f:
ln = ln.split()
if len(ln) == 0:
Expand All @@ -39,7 +39,7 @@ def parse_mapfile(filename: str) -> Tuple[str, Dict[str, object]]:
continue

value = ln[1]
if value.startswith('"'):
if value.startswith('"') or value.startswith("'"):
value = value[1:-1]
r.setdefault(key, value)

Expand Down

0 comments on commit 38631e3

Please sign in to comment.