How to fix Python “match” statement: SyntaxError: invalid syntax

Problem:

Your Python script crashes with SyntaxError: invalid syntax at a match statement, e.g.:

  File "main.py", line 234
    match param:
          ^
SyntaxError: invalid syntax

Solution:

Match statement exist since Python 3.10 – you are using a Python 3.9 or earlier version. You either need to upgrade your Python to 3.10 or later, or rewrite the code and remove the match statement!