Pylint导致RuntimeError:生成器使用最新的软件包版本引发了StopIteration

时间:2019-09-09 21:56:38

标签: python pylint

这是我的软件包版本,

This is how I get into console.
CMPS 161 
MATH 223 
MATH 200 
HIST 101 
MATH 223 
MATH 200 
HIST 101 
PHYS 101 
MUSC 101 
PSYC 101 
SSYC 101 

我跑步时

$ pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.7.4 (default, Aug 14 2019, 12:09:51) 
[GCC 8.3.0]

我得到一个pylint {package_name} ,如下所示:

RuntimeError

从某些搜索来看,似乎应该使用Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/astroid/protocols.py", line 492, in _infer_context_manager enter = next(inferred.igetattr("__enter__", context=context)) StopIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/pylint", line 10, in <module> sys.exit(run_pylint()) File "/usr/local/lib/python3.7/site-packages/pylint/__init__.py", line 20, in run_pylint Run(sys.argv[1:]) File "/usr/local/lib/python3.7/site-packages/pylint/lint.py", line 1628, in __init__ linter.check(args) File "/usr/local/lib/python3.7/site-packages/pylint/lint.py", line 943, in check self._do_check(files_or_modules) File "/usr/local/lib/python3.7/site-packages/pylint/lint.py", line 1075, in _do_check self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers) File "/usr/local/lib/python3.7/site-packages/pylint/lint.py", line 1158, in check_astroid_module walker.walk(ast_node) File "/usr/local/lib/python3.7/site-packages/pylint/utils.py", line 1303, in walk self.walk(child) File "/usr/local/lib/python3.7/site-packages/pylint/utils.py", line 1300, in walk cb(astroid) File "/usr/local/lib/python3.7/site-packages/pylint/checkers/variables.py", line 1590, in visit_import module = next(_infer_name_module(node, parts[0])) File "/usr/local/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference yield from islice(iterator, size) File "/usr/local/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator for result in generator: File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred yield next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped res = next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/inference.py", line 240, in infer_import yield self.do_import_module(name) File "/usr/local/lib/python3.7/site-packages/astroid/mixins.py", line 100, in do_import_module modname, level=level, relative_only=level and level >= 1 File "/usr/local/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 619, in import_module return MANAGER.ast_from_module_name(absmodname) File "/usr/local/lib/python3.7/site-packages/astroid/manager.py", line 171, in ast_from_module_name return self.ast_from_file(found_spec.location, modname, fallback=False) File "/usr/local/lib/python3.7/site-packages/astroid/manager.py", line 91, in ast_from_file return AstroidBuilder(self).file_build(filepath, modname) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 136, in file_build return self._post_build(module, encoding) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 153, in _post_build self.add_from_names_to_locals(from_node) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 206, in add_from_names_to_locals imported = node.do_import_module() File "/usr/local/lib/python3.7/site-packages/astroid/mixins.py", line 100, in do_import_module modname, level=level, relative_only=level and level >= 1 File "/usr/local/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 619, in import_module return MANAGER.ast_from_module_name(absmodname) File "/usr/local/lib/python3.7/site-packages/astroid/manager.py", line 171, in ast_from_module_name return self.ast_from_file(found_spec.location, modname, fallback=False) File "/usr/local/lib/python3.7/site-packages/astroid/manager.py", line 91, in ast_from_file return AstroidBuilder(self).file_build(filepath, modname) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 136, in file_build return self._post_build(module, encoding) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 156, in _post_build self.delayed_assattr(delayed) File "/usr/local/lib/python3.7/site-packages/astroid/builder.py", line 223, in delayed_assattr for inferred in node.expr.infer(): File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 141, in raise_if_nothing_inferred yield from generator File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped res = next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/inference.py", line 279, in infer_attribute for owner in self.expr.infer(context): File "/usr/local/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference yield from islice(iterator, size) File "/usr/local/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator for result in generator: File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 141, in raise_if_nothing_inferred yield from generator File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped res = next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/bases.py", line 137, in _infer_stmts for inferred in stmt.infer(context=context): File "/usr/local/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference yield from islice(iterator, size) File "/usr/local/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator for result in generator: File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred yield next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped generator = _func(node, context, **kwargs) File "/usr/local/lib/python3.7/site-packages/astroid/inference.py", line 832, in infer_assign stmts = list(self.assigned_stmts(context=context)) File "/usr/local/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred yield next(generator) File "/usr/local/lib/python3.7/site-packages/astroid/protocols.py", line 537, in with_assigned_stmts yield from _infer_context_manager(self, mgr, context) RuntimeError: generator raised StopIteration 解决了此错误,但是,使用Pylint 2.x的最新版本仍然出现了错误。有修复程序吗?

0 个答案:

没有答案