palantir / python-language-server

An implementation of the Language Server Protocol for Python
MIT License
2.6k stars 282 forks source link

SyntaxError: invalid syntax / print '%s%s' % (' ' * indent, name) #899

Closed liar666 closed 3 years ago

liar666 commented 3 years ago

Just installed pyls in a fresh venv with only dash. Trying to run pyls crashes directly:

$ pyls 
Traceback (most recent call last):
  File "/home/user/Python/TestDash/bin/pyls", line 5, in <module>
    from pyls.main import main
  File "/home/user/Python/TestDash/lib/python3.8/site-packages/pyls/main.py", line 65
    print '%s%s' % ('    ' * indent, name)
          ^
SyntaxError: invalid syntax

Line 65 & 73 are not in python 3 syntax. => use print(...) not print ...

liar666 commented 3 years ago

Also line 39 main.py

p2 __dict__.diritems(): -> p3 __dict__.items():

With these corrections, pyls started solo at the command line works.

Unfortunately, even with these correction Emacs's lsp mode still reports crashes of pyls "server". EDIT: my bad: I was using pip install pyls directly instead of pip install python-language-server. Now it works!