GroundControl: SyntaxError: Missing parentheses in call to 'print'

We are following the directions in the Wiki and have gotten an error “SyntaxError: Missing parentheses in call to ‘print’”. We have just downloaded and unzipped the GroundControl package. It looks to me like Python 3 is expecting a parenthesis but the code may be written for Python 2? Anyone seen this before?

I think Kivy/GC requires python 2.7 at present.

2 Likes

Several of the ‘GC Installation Guides’ links have notices about the python 2.7 requirement, but it sounds like we need to chase down some others. Which directions, let’s get them corrected.

1 Like

Yeah, somewhere I saw Python 3 and since I’m trying to force myself to 3, decided to go with that. I think I still have 2 installed, so I’ll go back and reinstall things for 2. Of course I can’t find the reference to 3 now.

1 Like

One confusion might be that pyserial 3.3 is required. If that is mentioned somewhere, it should also mention that this is for Python 2.7

1 Like

I’m wondering if the Python3 reference was in the pySerial installation page. We can’t control that!

1 Like

Actually, it looks like the place I saw a python 3 was in the kivy installation instructions. The more fundamental issue was that the command “python” on my machine points to a python 3 interpreter.

Now that I’m using the right interpreter, I’m having different issues, but I’m going to open a new topic about that.

3 Likes

If you write print() function in a program and someone using Python 2.x tries to run it, they will get an error. To avoid this, it is a good practice to import print function :

from __future__ import print_function

The from future import print_function ; to bring the print function from Python 3 into Python 2.x. Now your code works on both Python 2.x and Python 3.x . The future statements need to be near the top of the file because they change fundamental things about the language, and so the compiler needs to know about them from the beginning.

1 Like