I have an issue using the "retry" tool from the tenacity library in python3. The "retry" decorator does not seem to work when I use a generator.
I have a code sample to illustrate my situation:
from tenacity import retry, wait_exponential
@retry(wait=wait_exponential(multiplier=1, min=1, max=1))
def test_retry():
print("test retry from tenacity")
for i in range(10):
if i == 0: raise Exception
yield i
def gen():
yield from test_retry()
bar = gen()
for foo in bar:
print(foo)
When it raises the Exception, it doesn't retry. Does somebody have an idea why this is not working?
Thanks