0

Sorry I am not familar with Python...

It gives me the following error message

  File "gen_compile_files_list.py", line 36
    print 'java files:', n_src
                      ^
SyntaxError: invalid syntax

I.e. caret points to last quote. What's wrong with it?

OS Windows 7, Python version 3.2.2

2
  • post the code around line 36. perhaps a missing bracket or something else. Commented Apr 5, 2012 at 21:26
  • instead of comma, use + or it maybe because n_src is not a string Commented Apr 5, 2012 at 21:27

3 Answers 3

4

On Python 3, print is a function. You need this:

print('java files:', n_src)
Sign up to request clarification or add additional context in comments.

7 Comments

Is it possible to run python 3 in 2 compatibility mod eor something?
No it is not. You can do it the other way around, use Python 3 features in Python 2. If you want Python 2 syntax, use Python 2.
It's worth noting you can have Python 3 and Python 2 installed at the same time.
@MatthewFlaschen Yes there is, but that's not the question that I was asked.
@Matthew pretty much anything falls under "or something" if you want to be like that. 2to3 sounds over the top for a Python novice.
|
2

print changed syntax between Python2 and Python3; it is now a function.

You would need to change:

 print 'java files:', n_src

to

 print('java files:', n_src)

Alternatively, you can try converting the code from Python2 to Python3 syntax with the 2to3 tool. Here is more information on the transition if you are interested. This way you can maintain a single code base that works on both versions.

As you are not familiar with python, try installing Python 2 instead and running the code with that.

Comments

1

print is a function in Python 3+. So:

print ('java files:', n_src)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.