deoplete-plugins / deoplete-jedi

deoplete.nvim source for Python
MIT License
588 stars 40 forks source link

PosixPath object has not attribute 'endswidth' #266

Closed petobens closed 4 years ago

petobens commented 4 years ago

Consider the following minimal init.vim file:

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/deoplete.nvim
set runtimepath+=$DOTVIM/bundle/repos/github.com/deoplete-plugins/deoplete-jedi
filetype plugin indent on

let g:deoplete#enable_at_startup = 1

Now do create a python file with the following two lines

import numpy as np
np.

after adding the period in np the following errors pops out:

[deoplete] Traceback (most recent call last):
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/child.py", line 194, in _gather_results
    result = self._get_result(context, source)
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/child.py", line 254, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 204, in gather_candidates
    completions = self.get_completions(script)
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/home/pedro/.config/nvim/bundle/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 149, in get_completions
    return script.completions()
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/__init__.py", line 291, in completions
    return self.complete(*self._pos, fuzzy=fuzzy)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/helpers.py", line 487, in wrapper
    return func(self, line, column, *args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/__init__.py", line 275, in complete
    return self._complete(line, column, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/__init__.py", line 283, in _complete
    return completion.complete()
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/completion.py", line 172, in complete
    cached_name, completion_names = self._complete_python(leaf)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/completion.py", line 283, in _complete_python
    cached_name, n = self._complete_trailer(dot.get_previous_leaf())
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/api/completion.py", line 384, in _complete_trailer
    values = infer_call_of_leaf(inferred_context, previous_leaf)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/helpers.py", line 80, in infer_call_of_leaf
    return context.infer_node(leaf)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/context.py", line 222, in infer_node
    return infer_node(self, node)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 157, in infer_node
    return _infer_node_if_inferred(context, element)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 170, in _infer_node_if_inferred
    return _infer_node_cached(context, element)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/cache.py", line 44, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 175, in _infer_node_cached
    return _infer_node(context, element)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/debug.py", line 82, in wrapper
    return func(*args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 83, in wrapper
    return func(context, *args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 185, in _infer_node
    return infer_atom(context, element)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 310, in infer_atom
    return context.py__getattribute__(atom, position=position)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/context.py", line 75, in py__getattribute__
    values = ValueSet.from_sets(name.infer() for name in names)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/base_value.py", line 427, in from_sets
    for set_ in sets:
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/context.py", line 75, in <genexpr>
    values = ValueSet.from_sets(name.infer() for name in names)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/names.py", line 279, in infer
    return tree_name_to_values(
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/plugins/__init__.py", line 21, in wrapper
    return built_functions[public_name](*args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/plugins/stdlib.py", line 862, in wrapper
    return func(inference_state, context, tree_name)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/plugins/django.py", line 176, in wrapper
    result = func(inference_state, context, tree_name)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/syntax_tree.py", line 753, in tree_name_to_values
    types = imports.infer_import(context, tree_name)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/cache.py", line 44, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/imports.py", line 55, in infer_import
    _prepare_infer_import(module_context, tree_name)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/imports.py", line 115, in _prepare_infer_import
    importer = Importer(module_context.inference_state, tuple(import_path),
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/imports.py", line 169, in __init__
    debug.speed('import %s %s' % (import_path, module_context))
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/context.py", line 216, in __repr__
    return '%s(%s)' % (self.__class__.__name__, self._value)
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/value/module.py", line 228, in __repr__
    self.is_stub()
  File "/home/pedro/.local/lib/python3.8/site-packages/jedi/inference/value/module.py", line 159, in is_stub
    if self._path is not None and self._path.endswith('.pyi'):
AttributeError: 'PosixPath' object has no attribute 'endswith'
Error from jedi: 'PosixPath' object has no attribute 'endswith'.  Use :messages / see above for error details.

For the current I'm on latest nvim and deoplete and using jedi 0.17.2

Shougo commented 4 years ago

Please report it on jedi issues. It is not deoplete-jedi issue.