diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 67bb19556681c0..1bebcaa1258bd6 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -16,18 +16,17 @@ Syntax Errors Syntax errors, also known as parsing errors, are perhaps the most common kind of complaint you get while you are still learning Python:: - - >>> while True print('Hello world') + >>> print('Are you suggesting that coconuts migrate?) File "", line 1 - while True print('Hello world') - ^ - SyntaxError: invalid syntax - + print('Are you suggesting that coconuts migrate?) + ^ + SyntaxError: unterminated string literal (detected at line 1) + The parser repeats the offending line and displays a little 'arrow' pointing at the earliest point in the line where the error was detected. The error is caused by (or at least detected at) the token *preceding* the arrow: in the -example, the error is detected at the function :func:`print`, since a colon -(``':'``) is missing before it. File name and line number are printed so you +example, the error is detected at the function :func:`print`, since a single quote +(``'``) is missing. Error message and line number is also printed so you know where to look in case the input came from a script.