pylint fails to detect geoip2.records.Country.iso_code field
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-geoip2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Ubuntu 20.04.3 LTS
python3-geoip2: 2.9.0+dfsg1-2
The following code:
from geoip2.database import Reader
reader = Reader(
response = reader.
country = response.country
print(type(
produces the following output:
$ python3 test.py
<class 'geoip2.
$ pylint test.py
************* Module test
test.py:5: [E1101(no-member), ] Instance of 'Country' has no 'iso_code' member
$ pylint --version
pylint 2.10.2
astroid 2.7.2
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]
As you can see, the `iso_code` field is definitely there, but for some reason `pylint` doesn't see it.
One potential reason for this maybe that `Country` class `__name__` doesn't include a package name:
$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from geoip2.records import Country
>>> Country.__name__
'Country'
Another potential reason may be confusion between `geoip2.
The problem does not appear if recent version of `geoip2` is installed from `pip`, so probably updating the code in Ubuntu package to recent version would help.
description: | updated |