简体   繁体   中英

PyCharm linter not resolving all PyQt5 import references properly

An extremely minor problem, but an annoying one all the same- as you can see in the picture below, some references are resolved correctly by the linter (like pyqtSignal and pyqtSlot), and some are not (pyqtProperty).

PyCharm可以找到pyqtSignal和pyqtSlot,但找不到pyqtProperty吗?

What's even weirder is that code using these 'unresolved' references run just fine, it's just the linter/syntax highlighter that can't seem to find this reference.

Software used:

  • PyCharm 2017.3 (but this also happened on PyCharm 2017.2.X as well)
  • Python 3.6.3
  • PyQt 5.6.0, Qt 5.6.2
  • Windows 10 Pro x64

I'm unable to install these packages on my machine in order to check, but this likely isn't an issue with PyCharm.

Try Ctrl+Click on QtCore . I'm guessing this will take you to a file. Is pyqtProperty in that file? I'm guessing not. However, I'm guessing pyqtSignal and pyqtSlot are.

A couple reasons come to mind for why this might be happening

  1. pyqtProperty is not supported with version 5.6.0 and you need to install a different version
  2. The the Python interpreter which you are using does not actually have the version installed which you think
  3. Is PyQt a python wrapper around a c++ package? I've seen it before where essentially the package was made wrong and the calls still went to c++ correctly, but they did not add in the Python object declarations correctly such that IDEs recognized them and a bug needed to be placed on the package's github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM