我试图按下面的方式使用重试模块,但是遇到了retrying.RetryError:每当遇到stop_max_delay时,如果有人提供如何修复它的输入,我会很感激。
import time
from retrying import retry
def retry_if_result_none(result):
"""Return True if we should retry (in this case when result is None), False otherwise"""
return result is None
@retry(stop_max_delay=10000,retry_on_result=retry_if_result_none)
def might_return_none():
print "Retry forever ignoring Exceptions with no wait if return value is True"
print "Start : %s" % time.ctime()
might_return_none()
print "End : %s" % time.ctime()错误:-
File "check_devices.py", line 15, in <module>
might_return_none()
File "build\bdist.win-amd64\egg\retrying.py", line 49, in wrapped_f
File "build\bdist.win-amd64\egg\retrying.py", line 214, in call
retrying.RetryError: RetryError[Attempts: 1289627, Value: None]发布于 2016-06-29 18:22:13
你应该像下面这样做
from retrying import retry, RetryError
try:
might_return_none()
except RetryError as e:
print "RetryError"
print "End : %s" % time.ctime()https://stackoverflow.com/questions/38104195
复制相似问题