Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Astroid 2.1.0 #201

Closed
clintonb opened this issue Nov 25, 2018 · 7 comments · Fixed by #204
Closed

Error when using Astroid 2.1.0 #201

clintonb opened this issue Nov 25, 2018 · 7 comments · Fixed by #204

Comments

@clintonb
Copy link

I get the following error when running pylint for a fresh install:

pylint --rcfile=pylintrc todo_project_name *.py
Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/usr/local/lib/python3.6/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1568, in __init__
    linter.load_plugin_modules(plugins)
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 650, in load_plugin_modules
    module = modutils.load_module_from_name(modname)
  File "/usr/local/lib/python3.6/site-packages/astroid/modutils.py", line 202, in load_module_from_name
    return load_module_from_modpath(dotted_name.split("."), path, use_sys)
  File "/usr/local/lib/python3.6/site-packages/astroid/modutils.py", line 245, in load_module_from_modpath
    module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
  File "/usr/local/lib/python3.6/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/usr/local/lib/python3.6/imp.py", line 217, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/pylint_django/__init__.py", line 6, in <module>
    from pylint_django import plugin
  File "/usr/local/lib/python3.6/site-packages/pylint_django/plugin.py", line 5, in <module>
    from pylint_django.checkers import register_checkers
  File "/usr/local/lib/python3.6/site-packages/pylint_django/checkers/__init__.py", line 3, in <module>
    from pylint_django.checkers.models import ModelChecker
  File "/usr/local/lib/python3.6/site-packages/pylint_django/checkers/models.py", line 11, in <module>
    from pylint_django.utils import node_is_subclass, PY3
  File "/usr/local/lib/python3.6/site-packages/pylint_django/utils.py", line 4, in <module>
    from astroid.util import YES
ImportError: cannot import name 'YES'

The offending code is at
https://github.com/PyCQA/pylint-django/blob/2ef61325fa2f0ca291099a599c197f79f01c5bb1/pylint_django/utils.py#L4

Astroid 2.1.0 was released a couple hours ago.

Given this project's dependency on Astroid, should it be listed in setup.py? That dependency needs to be limited to 2.0.4 for the time being.

@carlio
Copy link
Collaborator

carlio commented Nov 25, 2018

This was in the compatability layer here for a while, might be worth revisiting the decision to remove it @atodorov ?

Thanks for the report and PR @clintonb ! I will merge this for now but since every CI setup has different dependency settings I think we might need to, in the long term, have more of those compat fudges.

@atodorov
Copy link
Contributor

@carlio I think when I deleted the compatibility layer I replaced the imports with their to-be-deprecated counter parts instead of the new ones.

Not sure if we want this compatibility layer back or not. Also in the referenced PR I see a failure in Travis, maybe caused by other changes in pylint itself. Will look at them tomorrow.

@kerrermanisNL
Copy link

kerrermanisNL commented Nov 26, 2018

Just so it's very explicitly placed here, you can fix this by setting astroid==2.0.4 in your requirements as a work around.

@carlio
Copy link
Collaborator

carlio commented Nov 26, 2018

Pinning astroid==2.0.4 and pylint==2.1.1 should fix this.

@atodorov The PR is failing as the new pylint API seems to have removed a visit that pylint-django augments : pylint-dev/pylint@41d47dd#diff-58c6e1eef6e54ed1b2900be32164f516L77

I will put the compat layer back as there are too many combinations of dependencies of pylint-django dependencies and build system configurations to be too rigid with how pylint-django works. I know it's a bit ugly but it prevents builds from breaking for people often and gives us time to do a new release without always having bug reports from disgruntled users!

@carlio
Copy link
Collaborator

carlio commented Nov 26, 2018

Just uploaded 2.0.4 which will fix this.

@carlio carlio mentioned this issue Nov 26, 2018
atodorov pushed a commit that referenced this issue Nov 26, 2018
YES has been replaced with Uninferable. YES has been an alias to Uninferable for some time, and was recently removed.

Closes #201
Naramsim added a commit to PokeAPI/pokeapi that referenced this issue Dec 3, 2018
Naramsim added a commit to PokeAPI/pokeapi that referenced this issue Dec 6, 2018
@eamanu
Copy link

eamanu commented Dec 30, 2018

This bugs has been register on Debian Sid https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917717

@aerostitch
Copy link
Contributor

aerostitch commented Jan 2, 2019

Sorry for that I'm late on the release process of the Debian package. I'll update it today to latest version that already fixes this without pinning the astroid version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants