Jedi: AttributeError on webdriver.create_options() completion result (selenium)

Created on 1 Nov 2017  路  4Comments  路  Source: davidhalter/jedi

To reproduce:

$ ipython
Python 3.6.3 (v3.6.3:2c5fed86e0, Oct  3 2017, 00:32:08) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from selenium import webdriver

In [2]: d = webdriver.Chrome()

In [3]: d.create_options().<press Tab now>
Exception in thread Thread-34:
Traceback (most recent call last):
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/jedi/cache.py", line 119, in wrapper
    return dct[key]
KeyError: ((), frozenset())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/prompt_toolkit/interface.py", line 865, in run
    completions = list(buffer.completer.get_completions(document, complete_event))
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/terminal/ptutils.py", line 84, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/terminal/ptutils.py", line 94, in _get_completions
    for c in completions:
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
    completions = list(completions)
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/core/completer.py", line 1791, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/core/completer.py", line 1844, in _completions
    signature = _make_signature(jm)
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/IPython/core/completer.py", line 989, in _make_signature
    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/jedi/cache.py", line 121, in wrapper
    result = method(self, *args, **kwargs)
  File "/Users/hoefling/.virtualenvs/foo/lib/python3.6/site-packages/jedi/api/classes.py", line 347, in params
    raise AttributeError()
AttributeError

Environment:

 $ python -V
Python 3.6.3
$ ipython -V
6.2.1
$ pip list | grep jedi
jedi                                   0.11.0 
$ pip list | grep selenium
selenium                               3.6.0  
$ chromedriver --version
ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2)
bug

Most helpful comment

Tested on current master. Not only I can confirm this issue fixed, I also experience much faster code suggestions! Not going back to 0.11.0 now :-) thank you very much for keeping this great work up!

All 4 comments

Hi @hoefling

I think there's something broken in the IPython core implementation. This AttributeError is supposed to happen. params are not always available. I guess we could change the API a bit there - but as it stands it's pretty clearly documented that it raises an AttributeError if it's not a callable.

Can you open an issue on IPython for that?

I just realize they actually check that it is a function. Probably my issue after all - sorry for the noise.

I cannot reproduce it with master anymore. I suppose it was fixed somewhere along the lines. Let me know if there's still an issue.

I was able to reproduce it with v0.11.0. Just wait for the next release.

Tested on current master. Not only I can confirm this issue fixed, I also experience much faster code suggestions! Not going back to 0.11.0 now :-) thank you very much for keeping this great work up!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tim-win picture tim-win  路  8Comments

dpavlic picture dpavlic  路  7Comments

DonJayamanne picture DonJayamanne  路  4Comments

DonJayamanne picture DonJayamanne  路  6Comments

blueyed picture blueyed  路  4Comments