Friendly SyntaxError tracebacks - in English

Friendly-traceback aims to provide friendlier feedback when an exception is raised than what is done by Python. This file contains only examples of SyntaxError. Ideally, an example of each case handled by friendly-traceback should be included here.

Note

The content of this page is generated by running trb_syntax_english.py located in the tests/ directory. This needs to be done explicitly, independently of updating the documentation using Sphinx. On Windows, if Sphinx is installed on your computer, it is suggested instead to run make_trb.bat in the root directory as it will create similar files for all languages and update the documentation.

Friendly-traceback version: 0.0.19a Python version: 3.8.0

SyntaxError - Assign to keyword

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error1.py'
beyond the location indicated below by --> and ^.

   1: """ Should raise SyntaxError"""
   2:
-->3: def = 2
          ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You were trying to assign a value to the Python keyword 'def'.
    This is not allowed.

SyntaxError - Missing colon 1

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error2.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError"""
   2:
-->3: if True
             ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You wrote a statement beginning with
    'if' but forgot to add a colon ':' at the end

SyntaxError - Missing colon 2

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error3.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError"""
   2:
-->3: while True  # a comment
                  ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You wrote a 'while' loop but
    forgot to add a colon ':' at the end

SyntaxError - elif, not else if

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error4.py'
beyond the location indicated below by --> and ^.

   2:
   3: if False:
   4:     pass
-->5: else if True:
           ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You meant to use Python's 'elif' keyword
    but wrote 'else if' instead

SyntaxError - elif, not elseif

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error5.py'
beyond the location indicated below by --> and ^.

   2:
   3: if False:
   4:     pass
-->5: elseif True:
             ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You meant to use Python's 'elif' keyword
    but wrote 'elseif' instead

SyntaxError - malformed def statment - 1

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error6.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError"""
   2:
-->3: def :
          ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You tried to define a function or method
    and did not use the correct syntax.
    The correct syntax is:
        def name ( optional_arguments ):

SyntaxError - malformed def statment - 2

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error7.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError"""
   2:
-->3: def name  :
                ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You tried to define a function or method
    and did not use the correct syntax.
    The correct syntax is:
        def name ( optional_arguments ):

SyntaxError - malformed def statment - 3

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error8.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError"""
   2:
-->3: def ( arg )  :
          ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You tried to define a function or method
    and did not use the correct syntax.
    The correct syntax is:
        def name ( optional_arguments ):

SyntaxError - can’t assign to literal

Python exception:
    SyntaxError: cannot assign to literal

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error9.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: can't assign to literal"""
   2:
-->3: 1 = a
      ^

My best guess:
    You wrote an expression like
        1 = a
    where <1>, on the left hand-side of the equal sign, is
    or includes an actual number or string (what Python calls a 'literal'),
    and not the name of a variable. Perhaps you meant to write:
        a = 1

SyntaxError - can’t assign to literal - 2

Python exception:
    SyntaxError: cannot assign to literal

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error10.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: can't assign to literal"""
   2:
-->3: 1 = 2
      ^

My best guess:
    You wrote an expression like
        1 = 2
    where <1>, on the left hand-side of the equal sign, is
    or includes an actual number or string (what Python calls a 'literal'),
    and not the name of a variable.

SyntaxError - import X from Y

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error11.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: import pen from turtle
                 ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You wrote something like
        import pen from turtle
    instead of
        from turtle import pen

SyntaxError - EOL while scanning string literal

Python exception:
    SyntaxError: EOL while scanning string literal

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error12.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: EOL while scanning string literal"""
   2:
-->3: alphabet = 'abc
                     ^

My best guess:
    You starting writing a string with a single or double quote
    but never ended the string with another quote on that line.

SyntaxError - assignment to keyword (None)

Python exception:
    SyntaxError: cannot assign to None

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error13.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: cannot assign to None in Py 3.8
   2:    and can't assign to keyword before."""
   3:
-->4: None = 1
      ^

My best guess:
    None is a constant in Python; you cannot assign it a value.

SyntaxError - assignment to keyword (__debug__)

Python exception:
    SyntaxError: cannot assign to __debug__

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error14.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: cannot assign to __debug__ in Py 3.8
   2:    and assignment to keyword before."""
   3:
-->4: __debug__ = 1
      ^

My best guess:
    __debug__ is a constant in Python; you cannot assign it a value.

SyntaxError - unmatched closing parenthesis

Python exception:
    SyntaxError: unmatched ')'

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error15.py'
beyond the location indicated below by --> and ^.

   3: """
   4: a = (1,
   5:     2,
-->6:     3, 4,))
                ^

My best guess:
    The closing parenthesis ')' on line 6 does not match anything.

SyntaxError - unclosed parenthesis

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error16.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2: x = int('1'
-->3: if x == 1:
               ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    The opening parenthesis '(' on line 2 is not closed.

        2: x = int('1'

SyntaxError - unclosed parenthesis - 2

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error17.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2: a = (b+c
-->3: d = a*a
      ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    The opening parenthesis '(' on line 2 is not closed.

        2: a = (b+c

SyntaxError - mismatched brackets

Python exception:
    SyntaxError: closing parenthesis ']' does not match opening parenthesis '('

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error18.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
-->2: x = (1, 2, 3]
                  ^

My best guess:
    Python gave us the following informative message
    about the possible cause of the error:

        closing parenthesis ']' does not match opening parenthesis '('

    However, I do not recognize this information and I have
    to guess what went wrong, but I might guess incorrectly.

    The closing square bracket ']' on line 2 does not match the opening parenthesis '(' on line 2.

        2: x = (1, 2, 3]

SyntaxError - mismatched brackets - 2

Python exception:
    SyntaxError: closing parenthesis ']' does not match opening parenthesis '(' on line 2

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error19.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2: x = (1,
   3:      2,
-->4:      3]
            ^

My best guess:
    Python gave us the following informative message
    about the possible cause of the error:

        closing parenthesis ']' does not match opening parenthesis '(' on line 2

    However, I do not recognize this information and I have
    to guess what went wrong, but I might guess incorrectly.

    The closing square bracket ']' on line 4 does not match the opening parenthesis '(' on line 2.

        2: x = (1,

        4:      3]

SyntaxError - print is a function

Python exception:
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('hello')?

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error20.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: Missing parentheses in call to 'print' ..."""
-->2: print 'hello'
            ^

My best guess:
    Perhaps you need to type print('hello')?

    In older version of Python, 'print' was a keyword.
    Now, 'print' is a function; you need to use parentheses to call it.

SyntaxError - Python keyword as function name

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error21.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: def pass():
          ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You tried to use the Python keyword 'pass' as a function name.

SyntaxError - break outside loop

Python exception:
    SyntaxError: 'break' outside loop

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error22.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: 'break' outside loop"""
   2:
   3: if True:
-->4:     break
          ^

My best guess:
    The Python keyword 'break' can only be used inside a for loop or inside a while loop.

SyntaxError - continue outside loop

Python exception:
    SyntaxError: 'continue' not properly in loop

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error23.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: 'continue' outside loop"""
   2:
   3: if True:
-->4:     continue
          ^

My best guess:
    The Python keyword 'continue' can only be used inside a for loop or inside a while loop.

SyntaxError - quote inside a string

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error24.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: message = 'don't'
                     ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    There appears to be a Python identifier (variable name)
    immediately following a string.
    I suspect that you were trying to use a quote inside a string
    that was enclosed in quotes of the same kind.

SyntaxError - missing comma in a dict

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error25.py'
beyond the location indicated below by --> and ^.

   2:
   3: a = {'a': 1,
   4:      'b': 2
-->5:      'c': 3,
           ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    It is possible that you forgot a comma between items in a set or dict
    before the position indicated by --> and ^.

SyntaxError - missing comma in a set

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error26.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: a = {1, 2  3}
                 ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    It is possible that you forgot a comma between items in a set or dict
    before the position indicated by --> and ^.

SyntaxError - missing comma in a list

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error27.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: a = [1, 2  3]
                 ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    It is possible that you forgot a comma between items in a list
    before the position indicated by --> and ^.

SyntaxError - missing comma in a tuple

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error28.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
-->3: a = (1, 2  3)
                 ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    It is possible that you forgot a comma between items in a tuple,
    or between function arguments,
    before the position indicated by --> and ^.

SyntaxError - missing comma between function args

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error29.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax"""
   2:
   3:
-->4: def a(b, c d):
                 ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    It is possible that you forgot a comma between items in a tuple,
    or between function arguments,
    before the position indicated by --> and ^.

SyntaxError - can’t assign to function call - 1

Python exception:
    SyntaxError: cannot assign to function call

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error30.py'
beyond the location indicated below by --> and ^.

   3: Python 3.8: SyntaxError: cannot assign to function call
   4: """
   5:
-->6: len('a') = 3
      ^

My best guess:
    You wrote the expression
        len('a') = 3
    where len('a'), on the left hand-side of the equal sign, either is
    or includes a function call and is not simply the name of a variable.

SyntaxError - can’t assign to function call - 2

Python exception:
    SyntaxError: cannot assign to function call

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error31.py'
beyond the location indicated below by --> and ^.

   3: Python 3.8: SyntaxError: cannot assign to function call
   4: """
   5:
-->6: func(a, b=3) = 4
      ^

My best guess:
    You wrote an expression like
        my_function(...) = some value
    where my_function(...), on the left hand-side of the equal sign, is
    a function call and not the name of a variable.

SyntaxError - used equal sign instead of colon

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error32.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: invalid syntax
   2: """
   3:
-->4: ages = {'Alice'=22, 'Bob'=24}
                     ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    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 --> and ^.

SyntaxError - non-default argument follows default argument

Python exception:
    SyntaxError: non-default argument follows default argument

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error33.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: def test(a=1, b):
               ^

My best guess:
    In Python, you can define functions with only positional arguments

        def test(a, b, c): ...

    or only keyword arguments

        def test(a=1, b=2, c=3): ...

    or a combination of the two

        def test(a, b, c=3): ...

    but with the keyword arguments appearing after all the positional ones.
    According to Python, you used positional arguments after keyword ones.

SyntaxError - positional argument follows keyword argument

Python exception:
    SyntaxError: positional argument follows keyword argument

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error34.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: test(a=1, b)
                ^

My best guess:
    In Python, you can call functions with only positional arguments

        test(1, 2, 3)

    or only keyword arguments

        test(a=1, b=2, c=3)

    or a combination of the two

        test(1, 2, c=3)

    but with the keyword arguments appearing after all the positional ones.
    According to Python, you used positional arguments after keyword ones.

SyntaxError - f-string: unterminated string

Python exception:
    SyntaxError: f-string: unterminated string

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error35.py'
beyond the location indicated below by --> and ^.

   1: """Should raise SyntaxError: f-string: unterminated string
   2: """
   3:
-->4: print(f"Bob is {age['Bob]} years old.")
            ^

My best guess:
    Inside an f-string, which is a string prefixed by the letter f,
    you have another string, which starts with either a
    single quote (') or double quote ("), without a matching closing one.

SyntaxError - unclosed bracket

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error36.py'
beyond the location indicated below by --> and ^.

    4: def foo():
    5:     return [1, 2, 3
    6:
--> 7: print(foo())
       ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    The opening square bracket '[' on line 5 is not closed.

        5:     return [1, 2, 3

SyntaxError - unexpected EOF while parsing

Python exception:
    SyntaxError: unexpected EOF while parsing

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error37.py'.
It reached the end of the file and expected more content.

    5:     return [1, 2, 3,
    6:
    7: print(foo())

My best guess:
    Python gave us the following informative message
    about the possible cause of the error:

        unexpected EOF while parsing

    However, I do not recognize this information and I have
    to guess what went wrong, but I might guess incorrectly.

    The opening square bracket '[' on line 5 is not closed.

        5:     return [1, 2, 3,

SyntaxError - name is parameter and global

Python exception:
    SyntaxError: name 'x' is parameter and global

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error38.py'
beyond the location indicated below by --> and ^.

   3:
   4:
   5: def f(x):
-->6:     global x
          ^

My best guess:
    You are including the statement

            global x

    indicating that 'x' is a variable defined outside a function.
    You are also using the same 'x' as an argument for that
    function, thus indicating that it should be variable known only
    inside that function, which is the contrary of what 'global' implied.

SyntaxError - keyword as attribute

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error39.py'
beyond the location indicated below by --> and ^.

    9: a = A()
   10:
   11: a.x = 1
-->12: a.pass = 2
         ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    You cannot use the Python keyword pass as an attribute.

SyntaxError - content passed continuation line character

Python exception:
    SyntaxError: unexpected character after line continuation character

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error40.py'
beyond the location indicated below by --> and ^.

   2: SyntaxError: unexpected character after line continuation character
   3: """
   4:
-->5: print(\t)
               ^

My best guess:
    You are using the continuation character '\' outside of a string,
    and it is followed by some other character(s).
    I am guessing that you forgot to enclose some content in a string.

SyntaxError - keyword can’t be an expression

Python exception:
    SyntaxError: expression cannot contain assignment, perhaps you meant "=="?

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error41.py'
beyond the location indicated below by --> and ^.

   3: Python 3.8:  expression cannot contain assignment, perhaps you meant "=="?
   4: """
   5:
-->6: a = dict('key'=1)
               ^

My best guess:
    One of the following two possibilities could be the cause:
    1. You meant to do a comparison with == and wrote = instead.
    2. You called a function with a named argument:

           a_function(invalid=something)

    where 'invalid' is not a valid variable name in Python
    either because it starts with a number, or is a string,
    or contains a period, etc.

SyntaxError - invalid character in identifier

Python exception:
    SyntaxError: invalid character in identifier

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error42.py'
beyond the location indicated below by --> and ^.

   3:
   4: # Robot-face character below
   5:
-->6: 🤖 = 'Reeborg'
      ^

My best guess:
    You likely used some unicode character that is not allowed
    as part of a variable name in Python.
    This includes many emojis.

SyntaxError - keyword cannot be argument in def - 1

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error43.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: def f(None=1):
            ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    I am guessing that you tried to use the Python keyword
    None as an argument in the definition of a function.

SyntaxError - keyword cannot be argument in def - 2

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error44.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: def f(x, True):
               ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    I am guessing that you tried to use the Python keyword
    True as an argument in the definition of a function.

SyntaxError - keyword cannot be argument in def - 3

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error45.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: def f(*None):
             ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    I am guessing that you tried to use the Python keyword
    None as an argument in the definition of a function.

SyntaxError - keyword cannot be argument in def - 4

Python exception:
    SyntaxError: invalid syntax

A SyntaxError occurs when Python cannot understand your code.

Python could not parse the file 'TESTS:\syntax\raise_syntax_error46.py'
beyond the location indicated below by --> and ^.

   2: """
   3:
   4:
-->5: def f(**None):
              ^

My best guess:
    Python did not give us much information regarding
    the cause of the error. I make an effort below to guess what
    went wrong, but I might guess incorrectly.

    I am guessing that you tried to use the Python keyword
    None as an argument in the definition of a function.