pythonpython-2.7

Why is invalid syntax error print '%s does not exist in %s for %s' <---- % (


I'm using the script from V8 source repo and it gives me the error:

D:\v8\source\v8\tools\dev>v8gen.py x64.release
  File "D:\v8\source\v8\tools\dev\v8gen.py", line 147
    print '%s does not exist in %s for %s' % (
                                         ^
SyntaxError: invalid syntax

The file itself should be fine, since it's working on other environments, possibly Linux. But I'm running the script from the Windows 10 native shell (cmd).

I'm not familiar with Python; what might be wrong?


Solution

  • I think you are using Python 3.x, and this code is written in Python 2.x.

    Try to run it in the correct version of python, or change it to:

    print ('%s does not exist in %s for %s' % (
          self._options.builder, CONFIG, self._options.master))