Skip to content

Commit 86b8f6c

Browse files
committed
FIX: Escape backslashes before parsing strings
1 parent dc36a28 commit 86b8f6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nibabel/nicom/ascconv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def parse_ascconv(ascconv_str, str_delim='"'):
205205
attrs, content = ASCCONV_RE.match(ascconv_str).groups()
206206
attrs = OrderedDict((tuple(x.split('=')) for x in attrs.split()))
207207
# Normalize string start / end markers to something Python understands
208-
content = content.replace(str_delim, '"""')
208+
content = content.replace(str_delim, '"""').replace("\\", "\\\\")
209209
# Use Python's own parser to parse modified ASCCONV assignments
210210
tree = ast.parse(content)
211211

0 commit comments

Comments
 (0)