'PyLint AttributeError
Receving this error while running pylint on my py file
AttributeError: 'Import' object has no attribute 'infer_name_module'
Full trace:
$ pylint some_file.py
Traceback (most recent call last):
File "\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "\Scripts\pylint.exe\__main__.py", line 7, in <module>
File "\lib\site-packages\pylint\__init__.py", line 19, in run_pylint
Run(sys.argv[1:])
File "\lib\site-packages\pylint\lint.py", line 1394, in __init__
linter.check(args)
File "\lib\site-packages\pylint\lint.py", line 801, in check
self._do_check(files_or_modules)
File "\lib\site-packages\pylint\lint.py", line 938, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "\lib\site-packages\pylint\lint.py", line 1018, in check_astroid_module
walker.walk(ast_node)
File "\lib\site-packages\pylint\utils.py", line 1159, in walk
self.walk(child)
File "\lib\site-packages\pylint\utils.py", line 1156, in walk
cb(astroid)
File "\lib\site-packages\pylint\checkers\variables.py", line 1331, in visit_import
module = next(node.infer_name_module(parts[0]))
AttributeError: 'Import' object has no attribute 'infer_name_module'
Not sure for root cause.
pylint version 2.12.2
Solution 1:[1]
I'm a pylint maintainer. It's a bug in pylint, could you open an issue, please ? We'd need the code that create the crash if possible.
Edit : it was a bug in an old version of pylint 2.0.2, not 2.12.2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
