I new to python. I use Python 3.3 in Eclipse Kepler.
This is my code snippet:
f = Fibonacci(0,1)
for r in f.series():
if r > 100: break
print(r, end=' ')
At the line print(r, end = '')
, eclipse reports a syntax
error - Syntax error while detecting tuple
. However, the
program runs perfectly.
Why does this happen and how do I fix the error?
You can clear up this invalid syntax in Python by switching out the semicolon for a colon. Here, once again, the error message is very helpful in telling you exactly what is wrong with the line.
Running Python from within Eclipse py, and Eclipse will recognize it as Python code. Type in some Python code (for instance: print 2+2 ), then right-click on the Python file you've created and select Run As >> Python run . You should see the output of your Python code in the console at the bottom of the Eclipse window.
The first time we run a Python project, Eclipse will display the following Run As pop-up window. Click on Python Run and then click OK. Python will save the file for this module and then run its script; if there is no Console view in which to run the script. Eclipse will create a new one.
open eclipse application, click preferences click PyDev Click Interpreter Click Python Interpreter (below Figure 1) Click Choose from List button (below Figure 2) Select what ever Python version you want to use Click Apply Click OK Exit Eclipse ReOpen it and all fixed.
You need to specify the correct Grammar Version
in Eclipse. See here: print function in Python3
Is Grammar Version
3.3 in your setup? Steps - Project > Properties > Python Interpreter/Grammar. You might have to restart Eclipse to see the changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With