Warning
Most of the documentation was written prior to version 0.5 and needs to be updated. This work has now started for version 0.7 and we aim to have it completed before version 0.8 is available.
Comparison between Python versions: SyntaxErrors¶
In this file, we highlight differences between the information
given by different versions of Python when it comes to SyntaxError
.
The content of this file is likely of no use to anyone except for
people who write code to include new SyntaxError
cases.
The differences between Python versions can be:
The error message itself.
The location of the error as indicated by Python with
^
. We’ve decided to leave these out for now.
As a consequence, the information as to what we guess is the cause can be slightly different. So, we also show when we assign a different cause.
Note that the content below is extracted automaticaly by a simple program we wrote for this purpose. If the information is the same for Python 3.6 and 3.7, but changes for Python 3.8, we only show the differences between 3.7 and 3.8.
Different messages - from Python
3.7: SyntaxError: can't assign to yield expression 3.8: SyntaxError: cannot assign to yield expression
3.10: SyntaxError: cannot assign to yield expression here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: unterminated string literal (detected at line 3)
Different messages - from Python
3.7: SyntaxError: can't delete operator 3.8: SyntaxError: cannot delete operator
3.10: SyntaxError: cannot delete expression
Different messages - from Python
3.9: IndentationError: expected an indented block 3.10: IndentationError: expected an indented block after 'if' statement on line 3
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different messages - from Python
3.8: SyntaxError: can't use starred expression here 3.9: SyntaxError: cannot delete starred
Different messages - from Python
3.9: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(hello world!)? 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different messages - from Python
3.7: SyntaxError: can't delete function call 3.8: SyntaxError: cannot delete function call
Different explanation - by Friendly-traceback
3.6: When using a `from __future__ import` statement, you must import specific named features. The available features are `nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals, barry_as_FLUFL, generator_stop`. 3.7: When using a `from __future__ import` statement, you must import specific named features. The available features are `nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals, barry_as_FLUFL, generator_stop, annotations`.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Perhaps you thought that `i` could be used to represent the square root of `-1`. In Python, the symbol used for this is `j` and the complex part is written as `some_number` immediately followed by `j`, with no spaces in between. Perhaps you meant to write `3.0j`. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. Perhaps you thought that `i` could be used to represent the square root of `-1`. In Python, the symbol used for this is `j` and the complex part is written as `some_number` immediately followed by `j`, with no spaces in between. Perhaps you meant to write `3.0j`.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different explanation - by Friendly-traceback
3.7: It looks like you were trying to declare that `start` was a variable using the word `var`. However, even if you remove `var`, there would still be some some syntax errors. 3.8: It looks like you were trying to declare that `start` was a variable using the word `var`. If you remove `var`, you will have a valid Python statement.
Different messages - from Python
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: SyntaxError: expected 'except' or 'finally' block
Different explanation - by Friendly-traceback
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: You wrote a `try` block which did not include an `except` nor a `finally` block. Perhaps you meant to write either except: or finally:
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: ':' expected after dictionary key
Different explanation - by Friendly-traceback
3.9: It looks like the error occurred as you were writing a Python dict. Perhaps wrote a dict key without writing the corresponding value. 3.10: It looks like the error occurred as you were writing a Python dict. Perhaps you wrote a dict key without writing the corresponding value.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid imaginary literal
Different explanation - by Friendly-traceback
3.6: `something` is not a valid feature of module `__future__`. The available features are `nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals, barry_as_FLUFL, generator_stop`. 3.7: `something` is not a valid feature of module `__future__`. The available features are `nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals, barry_as_FLUFL, generator_stop, annotations`.
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: cannot use assignment expressions with literal
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: You cannot use the augmented assignment operator `:=`, sometimes called the walrus operator, with literals like `"word"`. You can only assign objects to identifiers (variable names).
Different messages - from Python
3.9: SyntaxError: EOL while scanning string literal 3.10: SyntaxError: unterminated string literal (detected at line 1)
Different messages - from Python
3.7: SyntaxError: can't assign to operator 3.8: SyntaxError: cannot assign to operator
3.10: SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '¾' (U+00BE)
Different explanation - by Friendly-traceback
3.6: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.6.8. 3.7: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.7.9.
3.8: `/` indicates that the previous arguments in a function definition are positional arguments. However, `*` indicates that the arguments that follow must be keyword arguments. When they are used together, `/` must appear before `*`.
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: comprehension inner loop cannot rebind assignment expression target 'j'
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: You are using the augmented assignment operator `:=` inside a comprehension to assign a value to the iteration variable `j`. This variable is meant to be used only inside the comprehension. The augmented assignment operator is normally used to assign a value to a variable so that the variable can be reused later. This is not possible for variable `j`.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.9: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: if i % 2 == 0: 3.10: You wrote an expression that includes some mathematical operations on the left-hand side of the equal sign which should be only used to assign a value to a variable.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: '(' was never closed
Different messages - from Python
3.7: SyntaxError: assignment to keyword 3.8: SyntaxError: cannot assign to __debug__
Different messages - from Python
3.8: SyntaxError: unexpected EOF while parsing 3.9: IndentationError: expected an indented block
3.10: IndentationError: expected an indented block after 'for' statement on line 3
Different explanation - by Friendly-traceback
3.8: Python tells us that it reached the end of the file and expected more content. 3.9: Line `6` identified above was expected to begin a new indented block.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different messages - from Python
3.7: SyntaxError: keyword can't be an expression 3.8: SyntaxError: cannot assign to True
3.9: SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
3.10: SyntaxError: cannot assign to True
Different explanation - by Friendly-traceback
3.7: You likely called a function using the Python keyword `True` as an argument: a_function(True=something) which Python interpreted as trying to assign a value to a Python keyword. You cannot assign a value to `True`. 3.8: `True` is a constant in Python; you cannot assign it a different value.
3.9: You likely called a function using the Python keyword `True` as an argument: a_function(True=something) which Python interpreted as trying to assign a value to a Python keyword. You cannot assign a value to `True`.
3.10: `True` is a constant in Python; you cannot assign it a different value.
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: assignment expression cannot rebind comprehension iteration variable 'i'
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: You are using the augmented assignment operator `:=` inside a comprehension to assign a value to the iteration variable `i`. This variable is meant to be used only inside the comprehension. The augmented assignment operator is normally used to assign a value to a variable so that the variable can be reused later. This is not possible for variable `i`.
Different messages - from Python
3.8: SyntaxError: keyword argument repeated 3.9: SyntaxError: keyword argument repeated: ad
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: did you forget parentheses around the comprehension target?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different explanation - by Friendly-traceback
3.9: You used square brackets, `[...]` instead of parentheses. Write the following instead: print(sum(i for i in [1, 2, 3] if i%2==0)) 3.10: Python indicates that the error is caused by `[` written immediately after `sum`. It is possible that you forgot a comma between items in a tuple, or between function arguments, at the position indicated by ^. Perhaps you meant to insert an operator like `+, -, *` between `sum` and `[`. The following lines of code would not cause any `SyntaxError`: print(sum, [i for i in [1, 2, 3] if i%2==0]) print(sum + [i for i in [1, 2, 3] if i%2==0]) print(sum - [i for i in [1, 2, 3] if i%2==0]) print(sum * [i for i in [1, 2, 3] if i%2==0]) Note: these are just some of the possible choices and that some of them might raise other types of exceptions. There is an additional possibility. You used square brackets, `[...]` instead of parentheses. Write the following instead: print(sum(i for i in [1, 2, 3] if i%2==0))
Different messages - from Python
3.9: SyntaxError: unexpected EOF while parsing 3.10: SyntaxError: '[' was never closed
Different explanation - by Friendly-traceback
3.9: Python tells us that it reached the end of the file and expected more content. I will attempt to be give a bit more information. The opening square bracket `[` on line 5 is not closed. 5: return [1, 2, 3, ^ 3.10: The opening square bracket `[` on line 5 is not closed. 5: return [1, 2, 3, ^
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '‹' (U+2039)
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: closing parenthesis ']' does not match opening parenthesis '(' on line 2
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: ':' expected after dictionary key
Different explanation - by Friendly-traceback
3.9: It looks like the error occurred as you were writing a Python dict. Perhaps wrote a dict key without writing the corresponding value. 3.10: It looks like the error occurred as you were writing a Python dict. Perhaps you wrote a dict key without writing the corresponding value.
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to literal
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to dict display
3.10: SyntaxError: cannot assign to dict literal here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '⁄' (U+2044)
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: multiple exception types must be parenthesized
Different explanation - by Friendly-traceback
3.9: I am guessing that you wanted to use an `except` statement with multiple exception types. If that is the case, you must surround them with parentheses. 3.10: I am guessing that you wanted to use an `except` statement with multiple exception types. If that is the case, you must surround them with parentheses.
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to set display
3.10: SyntaxError: cannot assign to set display here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different messages - from Python
3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.9: SyntaxError: too many nested parentheses
Different explanation - by Friendly-traceback
3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.9: Your code is too complex for Python: you need to reduce the number of parentheses contained inside other parentheses.
Different messages - from Python
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: SyntaxError: expected 'except' or 'finally' block
Different explanation - by Friendly-traceback
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: You wrote a `try` block which did not include an `except` nor a `finally` block. Perhaps you meant to write finally:
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: cannot delete named expression
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: You cannot delete the named expression `(a := 5)`. You can only delete names of objects, or items in mutable containers such as `list`, `set`, or `dict`.
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to f-string expression
3.10: SyntaxError: cannot assign to f-string expression here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.7: You wrote an expression that has the f-string `f'{x}'` on the left-hand side of the equal sign. An f-string should only appear on the right-hand side of an equal sign. 3.8: You wrote an expression that has the f-string `f'{x}'` on the left-hand side of the equal sign. An f-string should only appear on the right-hand side of an equal sign. You can only assign objects to identifiers (variable names).
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Valid names cannot begin with a number. Perhaps you forgot a multiplication operator, `1 * f`. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. Valid names cannot begin with a number. Perhaps you forgot a multiplication operator, `1 * f`.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected ':'
Different explanation - by Friendly-traceback
3.9: You likely meant to use Python's `elif` keyword but wrote `else if` instead. 3.10: Python told us that it expected a colon at the position indicated. However, adding a colon or replacing something else by a colon would not fix the problem. You likely meant to use Python's `elif` keyword but wrote `else if` instead.
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.
Different explanation - by Friendly-traceback
3.7: You are likely trying to assign a value within an f-string. This is not allowed. 3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected ':'
Different messages - from Python
3.7: SyntaxError: can't assign to function call 3.8: SyntaxError: cannot assign to function call
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.9: It is possible that you used an equal sign `=` instead of a colon `:` to assign values to keys in a dict before or at the position indicated by ^. 3.10: You wrote an expression like 'Alice' = variable_name where `'Alice'`, on the left-hand side of the equal sign, is or includes an actual object of type `str` and is not simply the name of a variable. You can only assign objects to identifiers (variable names). It is possible that you used an equal sign `=` instead of a colon `:` to assign values to keys in a dict.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: cannot use a starred expression in a dictionary value
Different explanation - by Friendly-traceback
3.9: You cannot have these two operators, `:` and `*`, following each other. It looks like you tried to use a starred expression as a dict value; this is not allowed. The following statement has no syntax error: {'a': (1, 2, 3)} 3.10: It looks like you tried to use a starred expression as a dict value; this is not allowed. The following statement has no syntax error: {'a': (1, 2, 3)}
Different explanation - by Friendly-traceback
3.6: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.6.8. 3.7: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.7.9.
3.8: `/` indicates that the previous arguments in a function definition are positional arguments. `*arg` must appear after `/` in a function definition.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.9: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: if x.a == 1: 3.10: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: if x.a == 1:
Different messages - from Python
3.6: SyntaxError: Generator expression must be parenthesized if not sole argument 3.7: SyntaxError: Generator expression must be parenthesized
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: unmatched ']'
Different explanation - by Friendly-traceback
3.7: The closing square bracket `]` on line 3 does not match anything. 3: 3]] ^ 3.8: The closing square bracket `]` on line 3 does not match anything.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Valid names cannot begin with a number. Perhaps you forgot a multiplication operator, `2 * pi`. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. Valid names cannot begin with a number. Perhaps you forgot a multiplication operator, `2 * pi`.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected ':'
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expression expected after dictionary key and ':'
Different messages - from Python
3.7: SyntaxError: can't assign to function call 3.8: SyntaxError: cannot assign to function call
3.10: SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different explanation - by Friendly-traceback
3.7: It looks like you were trying to declare that `start` was a variable using the word `var`. However, even if you remove `var`, there would still be some some syntax errors. 3.8: It looks like you were trying to declare that `start` was a variable using the word `var`. If you remove `var`, you will have a valid Python statement.
3.10: It looks like you were trying to declare that `var` was a variable using the word `var`. If you remove `var`, you will have a valid Python statement.
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: invalid digit '8' in octal literal
Different messages - from Python
3.7: SyntaxError: can't assign to function call 3.8: SyntaxError: cannot assign to function call
3.10: SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '🤖' (U+1F916)
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to literal
Different messages - from Python
3.7: SyntaxError: can't assign to operator 3.8: SyntaxError: cannot assign to operator
3.10: SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.6: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.6.8. 3.7: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.7.9.
3.8: You can only use `/` once in a function definition.
Different messages - from Python
3.7: SyntaxError: invalid token 3.8: SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
Different messages - from Python
3.7: SyntaxError: can't assign to conditional expression 3.8: SyntaxError: cannot assign to conditional expression
Different messages - from Python
3.7: SyntaxError: keyword can't be an expression 3.8: SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid imaginary literal
Different messages - from Python
3.7: SyntaxError: can't delete keyword 3.8: SyntaxError: cannot delete True
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: unmatched '}'
Different explanation - by Friendly-traceback
3.7: The closing curly bracket `}` on line 6 does not match anything. 6: 3, 4,}} ^ 3.8: The closing curly bracket `}` on line 6 does not match anything.
Different messages - from Python
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: SyntaxError: expected 'except' or 'finally' block
Different explanation - by Friendly-traceback
3.9: Either not a SyntaxError for this Python version, or case excluded for some other reason. 3.10: You wrote a `try` block which did not include an `except` nor a `finally` block. Perhaps you meant to write except Exception:
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.
Different explanation - by Friendly-traceback
3.6: You are likely using a 'debug' syntax of f-strings introduced in Python version 3.8. You are using version 3.6. 3.7: You are likely using a 'debug' syntax of f-strings introduced in Python version 3.8. You are using version 3.7.
3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to literal
3.10: SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected ':'
Different explanation - by Friendly-traceback
3.9: A function definition statement must end with a colon. 3.10: You wrote a statement beginning with `def` but forgot to add a colon `:` at the end.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Perhaps you forgot a comma?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: The name of a function must be a valid Python identifier, that is a name that begins with a letter or an underscore character, `_`, and which contains only letters, digits or the underscore character. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. The name of a function must be a valid Python identifier, that is a name that begins with a letter or an underscore character, `_`, and which contains only letters, digits or the underscore character.
Different messages - from Python
3.9: SyntaxError: EOL while scanning string literal 3.10: SyntaxError: unterminated string literal (detected at line 3)
Different messages - from Python
3.7: SyntaxError: can't assign to Ellipsis 3.8: SyntaxError: cannot assign to Ellipsis
3.10: SyntaxError: cannot assign to ellipsis here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected ':'
Different explanation - by Friendly-traceback
3.9: A function definition statement must end with a colon. You wrote `;` instead of a colon. 3.10: Python expected a colon at the position indicated. You wrote `;` instead of a colon.
Different messages - from Python
3.7: SyntaxError: assignment to keyword 3.8: SyntaxError: cannot assign to __debug__
Different messages - from Python
3.7: SyntaxError: can't delete literal 3.8: SyntaxError: cannot delete literal
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: unmatched ')'
Different explanation - by Friendly-traceback
3.7: The closing parenthesis `)` on line 6 does not match anything. 6: 3, 4,)) ^ 3.8: The closing parenthesis `)` on line 6 does not match anything.
Different messages - from Python
3.7: SyntaxError: can't assign to literal 3.8: SyntaxError: cannot assign to literal
3.10: SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expression expected after dictionary key and ':'
Different messages - from Python
3.7: SyntaxError: can't assign to keyword 3.8: SyntaxError: cannot assign to None
Different messages - from Python
3.8: SyntaxError: invalid syntax 3.9: SyntaxError: f-string: invalid syntax
3.10: SyntaxError: f-string: cannot use double starred expression here
Different messages - from Python
3.9: SyntaxError: can't use starred expression here 3.10: SyntaxError: cannot use starred expression here
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: cannot use assignment expressions with True
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: `True` is a constant in Python; you cannot assign it a different value.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: expected 'else' after 'if' expression
Different explanation - by Friendly-traceback
3.9: I am guessing that you were writing a comprehension or a generator expression and use the wrong order for a condition. The correct order depends if there is an `else` clause or not. For example, the correct order for a list comprehensions with condition can be either [f(x) if condition else other for x in sequence] # 'if' before 'for' or, if there is no `else` [f(x) for x in sequence if condition] # 'if' after 'for' 3.10: An `else some_value` clause was expected after the `if` expression.
Different messages - from Python
3.9: SyntaxError: EOF while scanning triple-quoted string literal 3.10: SyntaxError: unterminated triple-quoted string literal (detected at line 4)
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
Different explanation - by Friendly-traceback
3.9: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: elif i % 2 == 0: 3.10: You wrote an expression that includes some mathematical operations on the left-hand side of the equal sign which should be only used to assign a value to a variable.
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '‚' (U+201A)
3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Did you use copy-paste? Python indicates that you used the unicode character `‚` which is not allowed. I suspect that you used a fancy unicode quotation mark whose name is SINGLE LOW-9 QUOTATION MARK instead of a normal single or double quote for a string. Or perhaps, you meant to write a comma. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. I suspect that you used a fancy unicode quotation mark whose name is SINGLE LOW-9 QUOTATION MARK. Perhaps, you meant to write a comma.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
Different explanation - by Friendly-traceback
3.7: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: a = (b == 2) # issue #65 3.8: You used an assignment operator `=`; perhaps you meant to use an equality operator, `==`, or the walrus operator `:=`.
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '«' (U+00AB)
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '‹' (U+2039)
Different explanation - by Friendly-traceback
3.6: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.6.8. 3.7: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.7.9.
3.8: `/` indicates that the previous arguments in a function definition are positional arguments. You have unspecified keyword arguments that appear before the symbol `/`.
Different messages - from Python
3.7: SyntaxError: invalid token 3.8: SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: '[' was never closed
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '›' (U+203A)
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid hexadecimal literal
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid imaginary literal
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: SyntaxError: closing parenthesis ']' does not match opening parenthesis '('
Different messages - from Python
3.9: SyntaxError: Missing parentheses in call to 'print'. Did you mean print("""This is a very long string which results in a very long error message.""")? 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different explanation - by Friendly-traceback
3.6: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.6.8. 3.7: `/` indicates that the previous arguments in a function definition are positional arguments. This symbol can only be used with Python versions 3.8.0 or newer. You are using Python version 3.7.9.
3.8: `/` indicates that the previous arguments in a function definition are positional arguments. `*arg` must appear after `/` in a function definition.
Different messages - from Python
3.7: SyntaxError: can't assign to generator expression 3.8: SyntaxError: cannot assign to generator expression
Different messages - from Python
3.9: SyntaxError: Missing parentheses in call to 'print'. Did you mean print('hello')? 3.10: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Valid names cannot begin with a number. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. Valid names cannot begin with a number.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Did you mean `1.5e0`? Perhaps you meant to write `1.5e0` in scientific notation and forgot the numerical value for the exponent. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. Did you mean `1.5e0`? Perhaps you meant to write `1.5e0` in scientific notation and forgot the numerical value for the exponent.
Different messages - from Python
3.8: SyntaxError: invalid character in identifier 3.9: SyntaxError: invalid character '½' (U+00BD)
3.10: SyntaxError: invalid decimal literal
Different explanation - by Friendly-traceback
3.9: Did you use copy-paste? Python indicates that you used the unicode character `½` which is not allowed. You used the unicode character ½ which is known as VULGAR FRACTION ONE HALF I suspect that you meant to write the fraction `1/2` instead. 3.10: Python tells us that you have written an invalid number. However, I think that the problem might be the following. You used the unicode character ½ which is known as VULGAR FRACTION ONE HALF I suspect that you meant to write the fraction `1/2` instead.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
Different explanation - by Friendly-traceback
3.7: You likely used an assignment operator `=` instead of an equality operator `==`. The following statement would not contain a syntax error: while a == 1: 3.8: You used an assignment operator `=`; perhaps you meant to use an equality operator, `==`, or the walrus operator `:=`.
Different messages - from Python
3.8: SyntaxError: unexpected EOF while parsing 3.9: IndentationError: expected an indented block
3.10: IndentationError: expected an indented block after 'for' statement on line 3
Different explanation - by Friendly-traceback
3.8: Python tells us that it reached the end of the file and expected more content. 3.9: Line `4` identified above was expected to begin a new indented block.
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: You use the augmented assignment operator `:=` where the normal assignment operator `=` was required.
Different messages - from Python
3.9: SyntaxError: invalid syntax 3.10: SyntaxError: '(' was never closed
Different messages - from Python
3.7: SyntaxError: invalid syntax 3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.
Different explanation - by Friendly-traceback
3.6: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.6. 3.7: You appear to be using the operator `:=`, sometimes called the walrus operator. This operator requires the use of Python 3.8 or newer. You are using version 3.7.
3.8: Either not a SyntaxError for this Python version, or case excluded for some other reason.