Skip to content

TypeError when using pylint 2.8.1 #323

Closed
@BeryJu

Description

@BeryJu

When using pylint-django with pylint 2.8.1, I get this error:

Traceback (most recent call last):
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint/__init__.py", line 24, in run_pylint
    PylintRun(sys.argv[1:])
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint/lint/run.py", line 330, in __init__
    linter.load_plugin_modules(plugins)
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 503, in load_plugin_modules
    module = astroid.modutils.load_module_from_name(modname)
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/astroid/modutils.py", line 212, in load_module_from_name
    return importlib.import_module(dotted_name)
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/__init__.py", line 6, in <module>
    from pylint_django import plugin
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/plugin.py", line 5, in <module>
    from pylint_django.checkers import register_checkers
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/checkers/__init__.py", line 3, in <module>
    from pylint_django.checkers.models import ModelChecker
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/checkers/models.py", line 11, in <module>
    from pylint_django.utils import node_is_subclass, PY3
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/utils.py", line 9, in <module>
    from pylint_django.compat import Uninferable
  File "/Users/langhammerj/.local/share/virtualenvs/authentik-fAhVAmau/lib/python3.9/site-packages/pylint_django/compat.py", line 28, in <module>
    LOAD_CONFIGURATION_SUPPORTED = pylint.__pkginfo__.numversion >= (2, 3)
TypeError: '>=' not supported between instances of 'list' and 'tuple'

I was able to fix it by adding a tuple() call to https://github.com/PyCQA/pylint-django/blob/master/pylint_django/compat.py#L28

LOAD_CONFIGURATION_SUPPORTED = tuple(pylint.__pkginfo__.numversion) >= (2, 3)
pip freeze
```
aiohttp==3.7.4.post0
aioredis==1.3.1
amqp==5.0.6
appdirs==1.4.4
asgiref==3.3.4
astroid==2.5.6
async-timeout==3.0.1
attrs==20.3.0
autobahn==21.3.1
Automat==20.2.0
bandit==1.7.0
billiard==3.6.4.0
black==20.8b1
boto3==1.17.54
botocore==1.20.57
bump2version==1.0.1
cachetools==4.2.1
cbor2==5.2.0
celery==5.0.5
certifi==2020.12.5
cffi==1.14.5
channels==3.0.3
channels-redis==3.2.0
chardet==4.0.0
click==7.1.2
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.1.6
colorama==0.4.4
constantly==15.1.0
coreapi==2.3.3
coreschema==0.0.4
coverage==5.5
cryptography==3.4.7
dacite==1.6.0
daphne==3.0.2
defusedxml==0.7.1
Django==3.2
django-dbbackup==3.3.0
django-filter==2.4.0
django-guardian==2.3.0
django-model-utils==4.1.1
django-otp==1.0.3
django-prometheus==2.1.0
django-redis==4.12.1
django-storages==1.11.1
djangorestframework==3.12.4
djangorestframework-guardian==0.3.0
docker==5.0.0
drf-yasg==1.20.0
facebook-sdk==3.1.0
future==0.18.2
geoip2==4.1.0
gitdb==4.0.7
GitPython==3.1.15
google-auth==1.29.0
gunicorn==20.1.0
h11==0.12.0
hiredis==2.0.0
httptools==0.1.1
hyperlink==21.0.0
idna==2.10
incremental==21.3.0
inflection==0.5.1
iniconfig==1.1.1
isort==5.8.0
itypes==1.2.0
Jinja2==2.11.3
jmespath==0.10.0
jsonschema==3.2.0
kombu==5.0.2
kubernetes==12.0.1
lazy-object-proxy==1.6.0
ldap3==2.9
lxml==4.6.3
MarkupSafe==1.1.1
maxminddb==2.0.3
mccabe==0.6.1
msgpack==1.0.2
multidict==5.1.0
mypy-extensions==0.4.3
oauthlib==3.1.0
packaging==20.9
pathspec==0.8.1
pbr==5.5.1
plexauth==0.0.6
pluggy==0.13.1
prometheus-client==0.10.1
prompt-toolkit==3.0.18
psycopg2-binary==2.8.6
pudb==2020.1
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pycryptodome==3.10.1
pycryptodomex==3.10.1
Pygments==2.8.1
PyHamcrest==2.0.2
pyjwkest==1.4.2
pylint==2.8.1
pylint-django==2.4.3
pylint-plugin-utils==0.6
pyOpenSSL==20.0.1
pyparsing==2.4.7
pyrsistent==0.17.3
pytest==6.2.3
pytest-django==4.2.0
python-dateutil==2.8.1
python-dotenv==0.17.0
pytz==2021.1
PyYAML==5.4.1
redis==3.5.3
regex==2021.4.4
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.2
ruamel.yaml==0.17.4
ruamel.yaml.clib==0.2.2
s3transfer==0.4.2
selenium==3.141.0
sentry-sdk==1.0.0
service-identity==18.1.0
six==1.15.0
smmap==4.0.0
sqlparse==0.4.1
stevedore==3.3.0
structlog==21.1.0
swagger-spec-validator==2.7.3
toml==0.10.2
Twisted==20.3.0
txaio==21.2.1
typed-ast==1.4.3
typing-extensions==3.7.4.3
uritemplate==3.0.1
urllib3==1.26.4
urwid==2.1.2
uvicorn==0.13.4
uvloop==0.15.2
vine==5.0.0
watchgod==0.7
wcwidth==0.2.5
webauthn==0.4.7
websocket-client==0.58.0
websockets==8.1
wrapt==1.12.1
xmlsec==1.3.9
yarl==1.6.3
zope.interface==5.4.0
```

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