ESP32-Cam Camera Web Server compiler error

I am compiling using MacBook air 2020 M1 chip
Big Sur 11.5.2

When compiling the ESP-32 CAM example CameraWebServer I get the following Error:
File "/Users/frankgriffin/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/gen_esp32part.py", line 536
print(e, file=sys.stderr)
^
SyntaxError: invalid syntax
strong text

Does anyone know a work around to this??

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

Python 2.7.16

I installed python 3.9 but I do not know how to make it the default.

Unfortunately, I don't know much about macOS. You will need to make sure the location of the Python 3 installation comes first in your PATH environment variable, before the Python 2 path. I'm sure there is a very user friendly way to do that, but I'm not sure what it is.

I see this:
https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion
You could go into that file and make sure to add the path of the Python 3 installation above the Python 2 one in the file.

Got python 3 as my default python. It makes no difference.

frankgriffin@Franks-MacBook-Air ~ % echo $path

/Library/Frameworks/Python.framework/Versions/3.9/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin

frankgriffin@Franks-MacBook-Air ~ % python --version

Python 3.9.7

frankgriffin@Franks-MacBook-Air ~ %

Hi, @fegriffin

Look at the previous line to the line indicated.
You may have a syntax error there.

Sorry I am not familiar with Python, Arduino C++ errors can originate from line of code before the code line that is identified as faulted.

Tom.. :smiley: :+1: :coffee: :australia:

The line that generates the error is in a Python script that is part of the ESP32 boards platform's toolchain:
https://github.com/espressif/arduino-esp32/blob/1.0.6/tools/gen_esp32part.py#L536
but now that I look at the code, this is not actually the line that contains the problematic code. This is in a try ... except block and is only printing the exception that was raised somewhere else in the code.

Unfortunately, that "somewhere else" is the main() function, meaning the entire script!

I notice there was a change to the script in the 2.0.0 release of ESP32 boards platform:
https://github.com/espressif/arduino-https://github.com/espressif/arduino-esp32/commit/a618fc1361b08aa968407dd81b7b065cca207f46#diff-f04d57c30bf198330d097ecd0999d61fe613442da9dcf94f5395b071e8f5238b

Do you still get the error after you use the Arduino IDE's Boards Manager (Tools > Board > Boards Manager) to update to 2.0.0? Even if there is a reason you are using 1.0.6, it's worth doing just as an experiment. You can always install 1.0.6 again after.