Jedi: AttributeError: 'CompiledObject' object has no attribute 'sub_modules_dict' for PyQt imports completions

Created on 29 Nov 2019  路  1Comment  路  Source: davidhalter/jedi

Hi, an error raises when trying to get completions for PyQt imports. As an example the following code:

from jedi import Script

# Over 'QA' in 'from PyQt5.QtWidgets import QApplication'
doc_pyqt = "from PyQt5.QtWidgets import QA"
script = Script(doc_pyqt, 1, len(doc_pyqt))
script.completions()
Traceback (most recent call last):

  File "C:\Users\Daniel\.spyder-py3-dev\temp.py", line 14, in <module>
    script.completions()

  File "C:\Users\Daniel\Anaconda3\envs\spyder4\lib\site-packages\jedi\api\__init__.py", line 215, in completions
    return completion.completions()

  File "C:\Users\Daniel\Anaconda3\envs\spyder4\lib\site-packages\jedi\api\completion.py", line 114, in completions
    completion_names = self._get_context_completions(leaf)

  File "C:\Users\Daniel\Anaconda3\envs\spyder4\lib\site-packages\jedi\api\completion.py", line 219, in _get_context_completions
    only_modules=only_modules,

  File "C:\Users\Daniel\Anaconda3\envs\spyder4\lib\site-packages\jedi\api\completion.py", line 280, in _get_importer_names
    return i.completion_names(self._evaluator, only_modules=only_modules)

  File "C:\Users\Daniel\Anaconda3\envs\spyder4\lib\site-packages\jedi\evaluate\imports.py", line 356, in completion_names
    names += context.sub_modules_dict().values()

AttributeError: 'CompiledObject' object has no attribute 'sub_modules_dict'

Jedi version: 1.15.1
Python version: 3.7.3

As discussed in palantir/python-language-server#706 and spyder-ide/spyder#10878

Most helpful comment

You might just be lucky, I fixed this in 98b592cb682abeb87898adfbd3e4bcd17f000495, about 2 hours before you reported :)

At the same time this is not released and it will probably take a month or two to release.

>All comments

You might just be lucky, I fixed this in 98b592cb682abeb87898adfbd3e4bcd17f000495, about 2 hours before you reported :)

At the same time this is not released and it will probably take a month or two to release.

Was this page helpful?
0 / 5 - 0 ratings