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

Astroid version 2.2 (with pylint 2.2) is causing exceptions #649

Closed
jan11011977 opened this issue Feb 27, 2019 · 5 comments
Closed

Astroid version 2.2 (with pylint 2.2) is causing exceptions #649

jan11011977 opened this issue Feb 27, 2019 · 5 comments

Comments

@jan11011977
Copy link

jan11011977 commented Feb 27, 2019

A new version of astroid was just deployed which is causing pylint to crash. I have Pylint pinned to version 2.2.2. but I hadn't pinned astroid, so that package was upgraded to 2.2.0. This then caused the crash:

PS D:\shared\python\ctn-compass> D:\shared.venv3.7.1\python\ctn-compass\scripts\pylint --rcfile=..\pylintrc src
Traceback (most recent call last):
File "d:\shared.venv3.7.1\python\ctn-compass\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\shared.venv3.7.1\python\ctn-compass\scripts\pylint.exe_main
.py", line 9, in
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint_init
.py", line 20, in run_pylint
Run(sys.argv[1:])
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\lint.py", line 1608, in init
linter.check(args)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\lint.py", line 938, in check
self._do_check(files_or_modules)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\lint.py", line 1071, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\lint.py", line 1154, in check_astroid_module
walker.walk(ast_node)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\utils.py", line 1269, in walk
self.walk(child)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\utils.py", line 1266, in walk
cb(astroid)
File "d:\shared.venv3.7.1\python\ctn-compass\lib\site-packages\pylint\checkers\variables.py", line 1582, in visit_import
module = next(node.infer_name_module(parts[0]))
AttributeError: 'Import' object has no attribute 'infer_name_module'

Maybe astroid version 2.2.0 is incompabitl with pylint 2.2.2?

@PCManticore
Copy link
Contributor

@jan11011977 Yeah, it looks like it! Can you try with pylint 2.3.0? This was released today as well.

@jan11011977
Copy link
Author

Yeah pylint 2.3.0 + astroid 2.2.0 works fine.

The reason we pin pylint is that new versions often introduce new types of errors, and we don't want our CI to break due to these new errors. For example 2.3.0 introduces a new "no-else-raise" error.

sphuber added a commit to aiidateam/aiida-core that referenced this issue Feb 27, 2019
)

Version `2.3.0` of `pylint` that was released two hours ago, breaks on
python 3 with their `pylint-plugin-utils==0.4`. See `pylint-plugin-utils` issue:

  pylint-dev/pylint-plugin-utils#12

Similarly, `astroid==2.2.0` was just released which also causes pylint to
fail on python 3 so we pin this to `astroid==2.1.0`. See `astroid` issue:

  pylint-dev/astroid#649
@pdesgarets
Copy link

Same issue here. Seems like the change commit is 51891dc . A miss in reporting the breaking change in changelog + new major version ? Or is it supposed not to be part of the public API of astroid ?

@PCManticore
Copy link
Contributor

@pdesgarets That's not a public API of astroid, which pylint unfortunately was relying on. Update to the latest and you'll be good to go.

openstack-gerrit pushed a commit to openstack/manila that referenced this issue Mar 13, 2019
Older releases of pylint use  an internal API of
the astroid library that causes pylint
exceptions when parsing modules. The errors
are like:

 internal error with sending report for module ['manila/network/neutron/neutron_network_plugin.py']
 'Import' object has no attribute 'infer_name_module'

So let's use the latest version available
that doesn't have this issue.

[1] pylint-dev/astroid#649

Change-Id: I6031111e5c72470313642307b4596806cd5408df
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Mar 13, 2019
* Update manila from branch 'master'
  - Merge "[Pylint] Bump pylint version to latest"
  - [Pylint] Bump pylint version to latest
    
    Older releases of pylint use  an internal API of
    the astroid library that causes pylint
    exceptions when parsing modules. The errors
    are like:
    
     internal error with sending report for module ['manila/network/neutron/neutron_network_plugin.py']
     'Import' object has no attribute 'infer_name_module'
    
    So let's use the latest version available
    that doesn't have this issue.
    
    [1] pylint-dev/astroid#649
    
    Change-Id: I6031111e5c72470313642307b4596806cd5408df
mgasner added a commit to dagster-io/dagster that referenced this issue Mar 14, 2019
mgasner added a commit to dagster-io/dagster that referenced this issue Mar 14, 2019
mgasner added a commit to dagster-io/dagster that referenced this issue Mar 15, 2019
schrockn pushed a commit to dagster-io/dagster that referenced this issue Mar 15, 2019
jhermann added a commit to Springerle/py-generic-project that referenced this issue May 8, 2019
@mkorvas
Copy link

mkorvas commented Jan 3, 2020

I have observed the same exception message with the latest version of both Astroid and Pylint -- if anyone can confirm it's there, should it be tracked in a separate issue or do you prefer to continue discussing here?

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

No branches or pull requests

4 participants