ESP32-Cam Camera Web Server compiler error

It might be caused by the wrong version of Python being used. print was changed to a function in Python 3 and that gen_esp32part.py was written for Python 3. You'll get exactly this error by trying to execute that script using Python 2.

The ESP32 boards platform expects that you will have Python 3 installed and in your path so it will run via the python command.

What do you get if you run this command from a terminal?:

python --version