Pylint: no-name-in-module for all PyQt imports since 1.4

Created on 24 Nov 2014  路  3Comments  路  Source: PyCQA/pylint

Originally reported by: Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?)


Since I upgraded from 1.3.1 to 1.4.0 (and astroid from 1.2.1 to 1.3.2) I get this for any PyQt import:

#!text
E:  1, 0: No name 'QTimer' in module 'PyQt5.QtCore' (no-name-in-module)

Sample script:

#!python
from PyQt5.QtCore import QTimer

bug

All 3 comments

_Original comment by_ Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Since astroid 1.3, we don't import extension packages anymore (which previously happened). Instead, we have a list of safe extensions, which can be included. Try with --extension-package-whitelist=PyQt5 instead.

_Original comment by_ Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?):


Thanks, that worked (for the record if anyone else finds this: it's --extension-pkg-whitelist, not package). A better message would be very helpful though IMHO.

I noticed something similiar with pkg_resources though:

#!python
import pkg_resources
pkg_resources.resource_string

Leads to: E: 2,14: Module 'pkg_resources' has no 'resource_string' member (no-member)

I tried adding it to the whitelist which didn't help. Should I open another bug for this?

_Original comment by_ Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Thanks, it's pkg indeed. For pkg_resources open another issue, please, maybe it's something related to inference. We can't provide a better message than the current no-member for this, since checking that object is from an extension package will put a too much burden on the checking. If this is solved by --extension-pkg-whitelist, please close the issue.

Was this page helpful?
0 / 5 - 0 ratings