2
含pylint的錯誤 'TreeRebuilder3k' 對象有 'visit_joinedstr' 當進口functools沒有屬性
import functools
pylint的單行t.py
給出錯誤
AttributeError: 'TreeRebuilder3k' object has no attribute 'visit_joinedstr'
有沒有解決辦法?
版本信息:
$ pylint --version
No config file found, using default configuration
pylint 1.6.5,
astroid 1.4.9
Python 3.6.1 (default, Mar 21 2017, 21:49:16)
[GCC 5.4.0]
完整的錯誤與長回溯:
$ pylint t.py
No config file found, using default configuration
************* Module t
C: 1, 0: Missing module docstring (missing-docstring)
Traceback (most recent call last):
File "/usr/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/usr/lib/python3.6/site-packages/pylint/__init__.py", line 17, in run_pylint
Run(sys.argv[1:])
File "/usr/lib/python3.6/site-packages/pylint/lint.py", line 1333, in __init__
linter.check(args)
File "/usr/lib/python3.6/site-packages/pylint/lint.py", line 755, in check
self._do_check(files_or_modules)
File "/usr/lib/python3.6/site-packages/pylint/lint.py", line 886, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "/usr/lib/python3.6/site-packages/pylint/lint.py", line 967, in check_astroid_module
walker.walk(ast_node)
File "/usr/lib/python3.6/site-packages/pylint/utils.py", line 959, in walk
self.walk(child)
File "/usr/lib/python3.6/site-packages/pylint/utils.py", line 956, in walk
cb(astroid)
File "/usr/lib/python3.6/site-packages/pylint/checkers/variables.py", line 1051, in visit_import
module = next(node.infer_name_module(parts[0]))
File "/usr/lib/python3.6/site-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/lib/python3.6/site-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/lib/python3.6/site-packages/astroid/inference.py", line 123, in infer_import
yield self.do_import_module(name)
File "/usr/lib/python3.6/site-packages/astroid/mixins.py", line 129, in do_import_module
relative_only=level and level >= 1)
File "/usr/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 492, in import_module
return MANAGER.ast_from_module_name(absmodname)
File "/usr/lib/python3.6/site-packages/astroid/manager.py", line 136, in ast_from_module_name
return self.ast_from_file(filepath, modname, fallback=False)
File "/usr/lib/python3.6/site-packages/astroid/manager.py", line 86, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
File "/usr/lib/python3.6/site-packages/astroid/builder.py", line 141, in file_build
module = self._data_build(data, modname, path)
File "/usr/lib/python3.6/site-packages/astroid/builder.py", line 185, in _data_build
module = builder.visit_module(node, modname, node_file, package)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 154, in visit_module
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 154, in <listcomp>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 167, in visit
return visit_method(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 957, in visit_classdef
newnode = super(TreeRebuilder3k, self).visit_classdef(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 357, in visit_classdef
for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 357, in <listcomp>
for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 167, in visit
return visit_method(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 543, in visit_functiondef
assign_ctx=assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 528, in _visit_functiondef
for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 528, in <listcomp>
for child in node.body]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 167, in visit
return visit_method(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 447, in visit_expr
newnode.value = self.visit(node.value, newnode, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 167, in visit
return visit_method(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 315, in visit_call
for child in node.args]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 315, in <listcomp>
for child in node.args]
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 167, in visit
return visit_method(node, parent, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 549, in visit_generatorexp
newnode.elt = self.visit(node.elt, newnode, assign_ctx)
File "/usr/lib/python3.6/site-packages/astroid/rebuilder.py", line 165, in visit
visit_method = getattr(self, visit_name)
AttributeError: 'TreeRebuilder3k' object has no attribute 'visit_joinedstr'
pip3沒有安裝它的問題。我將不得不找出如何卸載,然後從git安裝它 –
pip不支持Python的任何版本檢查 –