I would like to execute the Python code, but in the event of a timeout error, I want the code to automatically retry after a 60-second delay and continue. However, if another error occurs, such as a permission issue, the code should exit with the corresponding error message. The current code I have below doesn't exit properly and gets stuck in an infinite loop. How can I modify the code to address this issue? Please advise
pause=60
while True:
try:
df=report.next_records() ##call the function here
except:
sleep(pause)
pause+=60
else:
break
Catch the specific Exception