Fresh install on Python 3.7.3, "pio run" errors with "Missing parentheses in call to 'print'"

Hey! I have previously used PlatformIO on older versions of python (around 2.7) a couple of years ago, and now I wanted to start using it again.

I did a fresh pip install platformio on Python 3.7.3, and then I created a new project pio init --board uno and tried to compile pio run. I get the following error:

  File "C:\Users\User\.platformio\platforms\atmelavr\builder\main.py", line 30

    print "Please unplug/plug device ..."

                                        ^

SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Please unplug/plug device ...")?

Which of course means that it’s trying to run some Python 2 code on my Python 3. How does that happen? I thought PlatformIO was Python 3 compatible?

Interestingly everything seems to work fine if I change that single line of source code.

Have you updated your platforms? pio platform update.

You might just be running a very old version of the platform-atmelavr package containing outdated code.

1 Like

Yup that was it, I went from 1.8.2 to 2.0.0. Thanks for the quick reply!

1 Like