spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.33k stars 1.62k forks source link

Internal Python Language Server error #16893

Closed muondude closed 2 years ago

muondude commented 2 years ago

Description

What steps will reproduce the problem?

Editing my file -- nothing more complicated than that.

Traceback

  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request
    handler_result = handler(params)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/python_lsp.py", line 350, in m_text_document__completion
    return self.completions(textDocument['uri'], position)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/python_lsp.py", line 261, in completions
    completions = self._hook('pylsp_completions', doc_uri, position=position)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_result.py", line 33, in from_call
    result = func()
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 68, in pylsp_completions
    ready_completions = [
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 69, in <listcomp>
    _format_completion(
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 181, in _format_completion
    'kind': _TYPE_MAP.get(d.type),
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/jedi/api/classes.py", line 719, in type
    return super().type
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/jedi/api/classes.py", line 189, in type
    return self._name.api_type
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/jedi/inference/names.py", line 620, in __getattr__
    return getattr(self._wrapped_name, name)
  File "/Users/sgasster/opt/anaconda3/envs/slda/lib/python3.9/site-packages/jedi/inference/value/klass.py", line 80, in api_type
    if definition.type == 'funcdef':

AttributeError: 'NoneType' object has no attribute 'type

Versions

Dependencies


# Mandatory:
applaunchservices >=0.1.7     :  0.2.1 (OK)
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.29.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.0 (OK)
jsonschema >=3.2.0            :  4.2.1 (OK)
keyring >=17.0.0              :  23.2.1 (OK)
nbconvert >=4.0               :  6.3.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.2 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.10.0 (OK)
pylint >=2.5.0;<2.10.0        :  2.7.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.2.2;<1.3.0          :  1.2.4 (OK)
pylsp_black >=1.0.0           :  None (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.0 (OK)
qtconsole >=5.1.0             :  5.1.1 (OK)
qtpy >=1.5.0                  :  1.11.2 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  58.5.3 (OK)
sphinx >=0.6.6                :  4.3.0 (OK)
spyder_kernels >=2.1.1;<2.2.0 :  2.1.3 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  None (OK)
matplotlib >=2.0.0            :  3.5.0 (OK)
numpy >=1.7                   :  1.21.4 (OK)
pandas >=1.1.1                :  1.3.4 (OK)
scipy >=0.17.0                :  1.7.2 (OK)
sympy >=0.7.3                 :  None (OK)
dalthviz commented 2 years ago

Hi @muondude thank you for the feedback. Could you update to Spyder 5.2.0 and check again if the error persists? Also, do you have some example code that triggers this error (from the traceback seems like is happening while doing a completion)?

Any new info in order to replicate this issue is greatly appreciated, let us know!

dalthviz commented 2 years ago

Closing due to lack of response