srusskih / SublimeJEDI

awesome Python autocompletion with SublimeText
MIT License
938 stars 109 forks source link

AttributeErrors since 0.13 update #259

Closed RicherMans closed 6 years ago

RicherMans commented 6 years ago

Hey there, I recently updated to the new version and got the following error everytime I type anything:

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 685, in on_query_completions
    res = vel.on_query_completions(prefix, locations)
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/sublime_jedi/completion.py", line 158, in on_query_completions
    cplns = [tuple(x) for x in self._sort_completions(cplns)]
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/sublime_jedi/completion.py", line 174, in _sort_completions
    key=lambda x: (
TypeError: 'NoneType' object is not iterable
Jedi - Python autocompletion.sublime_jedi.facade: `JediFacade.get_autocomplete` failed
Traceback (most recent call last):
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/sublime_jedi/facade.py", line 110, in get
    return getattr(self, 'get_' + _action)(*args, **kwargs)
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/sublime_jedi/facade.py", line 139, in get_autocomplete
    filter(lambda c: not c[0].endswith('\tparam'), completion))
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/sublime_jedi/facade.py", line 168, in _completion
    completions = self.script.completions()
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/api/__init__.py", line 174, in completions
    completions = completion.completions()
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/api/completion.py", line 98, in completions
    completion_names = self._get_context_completions()
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/api/completion.py", line 173, in _get_context_completions
    completion_names = list(self._get_keyword_completion_names(allowed_transitions))
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/api/completion.py", line 212, in _get_keyword_completion_names
    yield keywords.KeywordName(self._evaluator, k)
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/api/keywords.py", line 28, in __init__
    self.parent_context = evaluator.builtins_module
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/evaluate/cache.py", line 40, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/evaluate/__init__.py", line 115, in builtins_module
    return compiled.get_special_object(self, u'BUILTINS')
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/evaluate/compiled/__init__.py", line 27, in get_special_object
    evaluator.compiled_subprocess.get_special_object(identifier)
  File "/home/richman/.config/sublime-text-3/Packages/Jedi - Python autocompletion/dependencies/jedi/evaluate/compiled/context.py", line 460, in create_from_access_path
    for name, access in access_path.accesses:
AttributeError: 'tuple' object has no attribute 'accesses'

Any hits how to avoid that?

srusskih commented 6 years ago

@RicherMans thanks for report, could you please post a code fragment to reproduce the issue?

jmouradev commented 6 years ago

Hi,

For example, on Mac OS 10.13, this simple fragment code reproduces that issue reported. ST build 3176

screen shot 2018-07-13 at 15 12 17

RicherMans commented 6 years ago

Sorry, somehow didn't get any notification for this thread. I agree with @jmdev33376 , any autocompletion fails, even for built-in`s like print. After typing the any character, Sublime will hang for a second and report the error above.

srusskih commented 6 years ago

I manged to reproduce with numpy exmple.

As temporary workaround, I suggest wait for a fist completion (: Due to first long response from jedi, first completion (or other action that requires jedi) can be slow :(

Possible solution set actions in a queue and pass them to jedi one by one.

srusskih commented 6 years ago

Please check if #260 works for you. Thanks!

RicherMans commented 6 years ago

Thanks @srusskih ! That fix works and no errors appear. However it seems to be quite a bit slower :(

srusskih commented 6 years ago

@RicherMans can you describe the case when it slower? i'd like to try to reproduce (understand)

RicherMans commented 6 years ago

@srusskih actually that could have been an issue of my connection. I only use sublime for remote applications over a sshfs mounted drive. It was general knowledge to me that anaconda ( which includes jedi ) is super laggy for those cases, so I was a bit surprised that jedi lagged yesterday. Today everything is fine, I don't think it had anything to do with Jedi! Thanks a lot!

srusskih commented 6 years ago

@RicherMans thanks for your feedback. going merge change to master and release it today (I hope)