4

I am currently using Python3.2 in Eclipse JavaEE Indigo.

I use the function print as follows:

input = open('test.txt', 'r')
for line in input:
    print(line, end='')

Eclipse reports a syntax error with

print(line, end = '')

and it suggests that

Syntax error while detecting tuple.
print Found at: builtins
print(value, ..., sep=' ', end='\n', file=sys.stdout)

However, the program runs perfectly.

Is there anything I can do to remove the error symbol or is there any better solution for this problem ?

falsetru
  • 357,413
  • 63
  • 732
  • 636
PinkiePie-Z
  • 525
  • 1
  • 6
  • 28

1 Answers1

6

Change grammar version to Python 3.x.

Grammer Version

(Above image comes from http://pydev.org/manual_101_project_conf2.html)

falsetru
  • 357,413
  • 63
  • 732
  • 636
  • Does not work for me. I am using the Kepler release and my Interpreter is already set to Py 3.3. – Erran Morad Mar 18 '14 at 19:18
  • @BoratSagdiyev - what is your Grammar Version set to? (Not the interpreter) – Roberto Mar 18 '14 at 20:10
  • This fixes it in some cases, but the problem is that PyDev doesn't properly support 2.7 grammar. If you do `from __future__ import print_statement` then that becomes valid 2.7 grammar too, but PyDev improperly reports an error where there is none. If the OP wants to develop with 2.7 that only uses the new print function, but none of the other Python3 features, then using the Python3 grammar might not help. – Cerin Jun 25 '14 at 14:06