How to break only when KeyboardInterrupt is raised?
I have a something function that is not fully debugged that it can have a lot of random exceptions that I don't know about. But I want to ignore them except when I interrupt the process. Then I use a try...except... for it. For example
counter = 0
data = []
while True :
try :
data.append(something())
counter+=1
except :
continue
if counter % 100 == 0 :
yield data
data = []
yield data
How do I break it when I KeyboardInterrupt it?