This is a bit late, but if you still need to capture ctrl-c:
here's the general way to capture ctrl-c within a python script.
here's the general way to capture ctrl-c within a python script.
- 1st add
import signal
at top of script.
- somewhere near the (logical) start of your program, add:
signal.signal(signal.SIGINT, self.capture_ctrl_c)
- Add a function:
def capture_ctrl_c(self, sig, frame): print('User interrupt encountered\nAdd your ctrl-C code here') ...