Activity log for bug #1941625

Date Who What changed Old value New value Message
2021-08-25 16:44:20 Vasily Zakharov bug added bug
2021-08-25 16:45:28 Vasily Zakharov description Ubuntu 20.04.3 LTS python3-geoip2: 2.9.0+dfsg1-2 The following code: ```python3 from geoip2.database import Reader reader = Reader('/var/lib/GeoIP/GeoLite2-City.mmdb') response = reader.city('8.8.8.8') country = response.country print(type(country), country.iso_code) ``` produces the following output: ```python3 $ python3 test.py <class 'geoip2.records.Country'> US $ 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 $ 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.records.Country` and `geoip2.models.Country` that has no such field. 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. See also https://github.com/PyCQA/pylint/issues/4911. Ubuntu 20.04.3 LTS python3-geoip2: 2.9.0+dfsg1-2 The following code: from geoip2.database import Reader reader = Reader('/var/lib/GeoIP/GeoLite2-City.mmdb') response = reader.city('8.8.8.8') country = response.country print(type(country), country.iso_code) produces the following output: $ python3 test.py <class 'geoip2.records.Country'> US $ 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.records.Country` and `geoip2.models.Country` that has no such field. 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. See also https://github.com/PyCQA/pylint/issues/4911.