0
I have a python with selenium script that should be called with an argument that different for each person (I called it Tester.py), to make it easier I put it in a new python file and run it with a #subprocess like this :
# Explanation about retry is next
@retry(retry_count=5, delay=5)
def job():
try:
subprocess.Popen("python Tester.py -user Margareth", shell=True)
return True
except subprocess.CalledProcessError:
return False
print("System Retrying")
pass
my retry wrapper are look like this (but It's not working) :
def retry(retry_count=5, delay=5, allowed_exceptions=()):
def decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
for _ in range(retry_count):
try:
result = f(*args, **kwargs)
if result:
pass
except allowed_exceptions as e:
pass
time.sleep(delay)
return wrapper
return decorator
My only problem with Tester.py is TimeoutException from selenium, and I want to retry it if it failed for x times and x seconds delay, but somehow #try-catch not working and my retry always result in random second retry and it really messed, Any clue?