Python循环AttributeError:“NoneType”对象没有属性“execute”

2024-10-03 17:18:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用while循环来执行某些代码:

while (totalIter > 0):
    totalIter = totalIter - 1
    route_data = yield Runner.execute(endpoint, endpoint.config, command, send_data)

其中Runner作为from prov.runners.base import Runner导入

yield语句第一次运行良好,但在第二次执行循环时,它抛出以下错误

AttributeError: 'NoneType' object has no attribute 'execute'

表示Runner已变成{}。在

我试着去做,但没用。在

^{pr2}$

这就产生了错误:

AttributeError: 'NoneType' object has no attribute 'runners'

指示prov在第二次执行时是None。在

只尝试重新加载Runner,但python给出的错误是reload expects module as argument.

这个问题是否与加载模块或其他什么有关?在


Tags: noexecutedataobject错误endpointrunnerattributeerror