-
Notifications
You must be signed in to change notification settings - Fork 213
Error when running python-lsp-server with Electron+monaco editor: ERROR pylsp_jsonrpc.endpoint - Failed to handle request #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@pplonski I installed |
That's my pip freeze on fresh venv
|
@pplonski Perhaps you can update to a newer version. This is what I have.
From the error message it is clear there was a bug in 1.2.4. >>> import logging
>>> log = logging.getLogger(__name__)
>>> completion = "abc"
>>> e = "def"
>>> log.warning('Something went wrong when resolving label for {completion}: {e}', completion=completion, e=e)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'completion' |
I've updated
the error traceback that I got: JSON Server: 2021-11-24 09:04:30,010 CET - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 39
Traceback (most recent call last):
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/_resolvers.py", line 81, in resolve
sig = completion.get_signatures()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/api/classes.py", line 582, in get_signatures
for s in self._get_signatures()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/api/classes.py", line 570, in _get_signatures
names = convert_names([self._name], prefer_stubs=True)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/gradual/conversion.py", line 152, in convert_names
return _python_to_stub_names(names, fallback_to_python=prefer_stubs)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/utils.py", line 16, in wrapper
return list(func(*args, **kwargs))
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/gradual/conversion.py", line 126, in _python_to_stub_names
for x in _python_to_stub_names([n], fallback_to_python=fallback_to_python):
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/utils.py", line 16, in wrapper
return list(func(*args, **kwargs))
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/gradual/conversion.py", line 132, in _python_to_stub_names
v = name.get_defining_qualified_value()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/jedi/inference/names.py", line 251, in get_defining_qualified_value
if context.is_module() or context.is_class():
AttributeError: 'NoneType' object has no attribute 'is_module'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume
self._handle_request(message['id'], message['method'], message.get('params'))
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request
handler_result = handler(params)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
return method(**(params or {}))
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/python_lsp.py", line 350, in m_text_document__completion
return self.completions(textDocument['uri'], position)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/python_lsp.py", line 261, in completions
completions = self._hook('pylsp_completions', doc_uri, position=position)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/python_lsp.py", line 156, in _hook
return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
return outcome.get_result()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_result.py", line 33, in from_call
result = func()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 324, in <lambda>
lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/jedi_completion.py", line 67, in pylsp_completions
ready_completions = [
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/jedi_completion.py", line 68, in <listcomp>
_format_completion(
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/jedi_completion.py", line 179, in _format_completion
'label': _label(d, resolve_label_or_snippet),
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/jedi_completion.py", line 204, in _label
sig = LABEL_RESOLVER.get_or_create(definition)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/_resolvers.py", line 66, in get_or_create
self._cache[key] = self.resolve(completion)
File "/home/piotr/sandbox/example/pyls/venv/lib/python3.8/site-packages/pylsp/plugins/_resolvers.py", line 84, in resolve
log.warning(
File "/usr/lib/python3.8/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'completion' |
I've solved the issue by downgrading
Maybe it is somehow connected with davidhalter/jedi#1714 Don't know. Thank you @rcjsuen for the help! |
Yay to f-strings! Thanks for fixing this, @ccordoba12. |
The fix is now part of our 1.3.2 version (just released). |
I'm working on an example of the Electron app with monaco-editor and full Python completion. I'm using
python-lsp-server
. My repo is available at: https://github.com/pplonski/electron-monaco-python-lspI'm getting the following error in
pylsp
:Reproduce steps
After the last dot the exception will be thrown.
In the Electron app I get:
Is this issue related to
python-lsp-server
or rather to my settings and client code in Electron?The text was updated successfully, but these errors were encountered: