Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

PyQt5 symbols are not recognized #1853

Open

Description

Environment data

  • VS Code version: 1.41.1
  • Extension version (available under the Extensions sidebar): 2019.11.50794
  • OS and version: Windows_NT x64 10.0.18363
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions: PyQt5
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version vscode-python#3977): "python.jediEnabled": false

Expected behavior

with the settings.json file configured as
"python.autoComplete.extraPaths": [
"C:/Users/Administrator/.virtualenvs/PyQt5-w5h0JEeT/Lib/site-packages",
"C:/Users/Administrator/.virtualenvs/PyQt5-w5h0JEeT/Lib"
],
I expect the code navigation function works, but it does not.

Actual behaviour

for this line:
from PyQt5.Qt import *
it shows 'from PyQt5.Qt import *' used; unable to detect undefined namesflake8(F403)
and if I right click on QApplication symbol and then I select "Go to Definition", it shows "No definition found for QApplication "

meanwhile it works for
import sys
print(sys.argv)
"Go to Definition" for sys.argv get me to correct location in sys.pyi

Activity

  1. MikhailArkhipov commented on Jan 2, 2020

    @MikhailArkhipov

    Not entirely sure what unable to detect undefined names flake8(F403) means... flake8 is not part of the LS and F403 is not something LS code outputs.

    "No definition found for QApplication " is normal since Qt5 is compiled module in C++ and hence we do not have source to show. Actually, nav to sys.argv also shows 'no definition` since LS normally does not navigate to stubs per #1831.

  2. zhangguofu commented on Jan 3, 2020

    @zhangguofu
    Author

    The original motivation for this issue is that in PyCharm, we can check definitions for PyQt5 modules and it really helps to code quickly and correctly, but for VS Code there is no such experience, and it gets much harder to write PyQt5 programs.
    After firing this issue, I find out that the PyCharm experience is based on PyQt5-stubs, so I created a new future request for support of PyQt5-stubs for python extension
    #1854
    So we can close this issue if we are on the same page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions