If I have a for loop with a try-catch block, and I interrupt the kernel, the loop will go to error block and simply proceed to the next iteration. I would like to stop the loop entirely, is there a way to do that? Currently, I'll have to kill the kernel if I want to stop the loop, which means loading up the models, etc again, which takes time.
Example: I would like to know if there's a way to interrupt the entire for loop rather than just one iteration if I made a typo.
import time
for i in range(100):
try:
time.sleep(5)
print(i)
except:
print('err')