Syntax error while running "yolk -l"

646 Views Asked by At

I have installed yolk 0.4.3 using pip. But when I tried yolk -l to display all installed packages, it showed a syntax error

File "C:\Python32\Lib\site-packages\yolk\cli.py" line 262
print "%s %s (%s)" % (project name,dis,version,
                 ^
syntax error :invalid syntax
3

There are 3 best solutions below

0
Steve Barnes On

It looks like you are running a python 2 library with python 3 the versions need to match.

2
AudioBubble On

You have Python 2.x syntax with print when you are using Python 3.x (notice the "Python32" in "C:\Python32\Lib\site-packages\yolk\cli.py"). Below is an example written in Python 3.x:

>>> print "%s" % "a"
  File "<stdin>", line 1
     print "%s" % "a"
              ^
SyntaxError: invalid syntax
>>> print("%s" % "a")
a
>>>

As you can see, you need to use Python 3.x syntax (namely, treat print as a built-in, not a keyword).

To fix your problem, make sure your version of yolk works with your version of Python.

0
Dan On

It seems you're using the package yolk (which only works Python 2). To install yolk for Python 3 use the yolk3k package:

pip install yolk3k