>>> "asdf\"
File "<stdin>", line 1
"asdf\"
^
SyntaxError: unterminated string literal (detected at line 1)
Maybe there's room to make this error message more helpful, to make the source of the error more obvious for users unfamiliar with escapes. I propose the following:
>>> "asdf\"
File "<stdin>", line 1
"asdf\"
^
SyntaxError: unterminated string literal (detected at line 1); perhaps you escaped the end quote?
The raw string situation in the linked issues is a little extra tricky, since the workaround is less clear, but hopefully it makes it obvious to users what is going on.
hauntsaninja
changed the title
Improve error message for unterminated raw strings
Improve error message for unterminated strings with escapes
Dec 23, 2022
hauntsaninja commentedDec 23, 2022
•
edited by bedevere-bot
Inspired by #55688 and #94768.
Currently, this code raises the following error:
Maybe there's room to make this error message more helpful, to make the source of the error more obvious for users unfamiliar with escapes. I propose the following:
The raw string situation in the linked issues is a little extra tricky, since the workaround is less clear, but hopefully it makes it obvious to users what is going on.
Linked PRs
The text was updated successfully, but these errors were encountered: