python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

path error caused by 'to_fs_path' method

Open carter54 opened this issue 5 years ago • 0 comments

question about this method https://github.com/palantir/python-language-server/blob/21833eafd4e254a79d35ca539967f3a010e8c2a1/pyls/uris.py#L46 in windows, if I pass a uri started with 'C:\' for example:

from pyls.uris import to_fs_path
uri = 'C:\\py_test\\test.py'
value = to_fs_path(uri)
print(value)

the result shows:

\py_test\test.py

thus, an error appeared when I call the completion api when passing this 'C:\' included uri:

-32602, "FileNotFoundError: [Errno 2] No such file or directory: '\\\\py_test\\\\test.py'"

this error happened in this line: https://github.com/palantir/python-language-server/blob/21833eafd4e254a79d35ca539967f3a010e8c2a1/pyls/workspace.py#L143 It tried to open '\py_test\test.py' rather than 'C:\py_test\test.py'

carter54 avatar Apr 01 '20 02:04 carter54