Ashish
Ashish

Reputation: 81

Syntax error while running "yolk -l"

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

Upvotes: 6

Views: 652

Answers (3)

Dan
Dan

Reputation: 645

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

Upvotes: 6

user2555451
user2555451

Reputation:

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.

Upvotes: 0

Steve Barnes
Steve Barnes

Reputation: 28405

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

Upvotes: 0

Related Questions