Question: I get SyntaxError: Missing parentheses in call to ‘print’ when I invoke/execute ‘ preupg‘ command on my CentOS machine. What could be the issue?Here’s the snapshot of the error: # sudo preupgFile '/usr/bin/preupg', line 25print 'nAssessment interrupted.' ^SyntaxError: Missing parentheses in call to 'print'Solution:According to the error message, it seems like the issue might be due to version compatibility. The command preupg has been written based on Python version 2 and you are trying to execute it with Python version 3.According to the documentation of Python 3, ‘print’ needs parenthesis as shown below: print ('nAssessment interrupted.' );You may modifying the code of preupg (probably line number 25) with this change or use Python 2 as shown below.
$python2.6 /usr/bin/preupgNote: There are plenty of changes in Python 3, so you may not just stop with print statement alone. You may and others or infact port the complete application to support Python 3.
I have a foo.py Python file containing print 'bar' code. When I want to python foo.py my code, here is the error: SyntaxError: Missing parentheses in call to 'print. Yeah my whole env is in python3 but i'm calling the script via python2 but it seems that it is calling again python (and so python3 ) elsewhere in another dependencies.so 2options:remove the harcoded call to python or source a python 2 virtual env before execution.