I want to automate the python to re-run the code when it returns error, is it possible and how can I do it?
I have a script and each time that returns an error I have to run it again. The error does not interfere in the process, so it can't be a problem re-run.
When you face an error, typically, the program will halt. That's why there are error handlers in place to not let that happen.
Look at some already answered examples here
So, lets say you want the user to input integer values and it shouldn't halt, so you could use a loop and break it when the entered value is an integer (there's no error thrown)
...
while True:
try:
i = int(input("Integer: "))
break
except:
print("Error")
...
You get the idea.