I need to catch a KeyboardInterrupt
exception at any point in a large while loop but defer handling it at those points where I have all the balls in the air.
Specifically, I'm processing a MIDI file consisting of 2 and 3 byte midi events. I need to detect a KeyboardInterrupt at any time but I must never break off processing in the middle of a midi event.
Can someone please suggest the best way of doing this?