RPi.GPIO.wait_for_edge doesn't interact well with ctrl+c .
This has been reported here: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=151401
And previously, here: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=119847
I found one thread on googlegroups where people dealt with a similar issue, and they seem to have found the solution: https://groups.google.com/forum/#!topic/comp.lang.python/raOemE38PaY .
This is the relevant part:
After my previous experiment I was curious how this works with
input() [https://svn.python.org/projects/python/trunk/Parser/myreadline.c]. I replaced the sem.acquire() with raw_input() and ran the same
tests. Now the inner exception is really taken so it works like the OP
expected. The exception, however is KeyboardInterrupt, not the special
exception from the IPC module.
So I looked in the source code how they did it:
The code is in Parser/myreadline.c.This code for input in function calls PyErr_CheckSignals() and
PyOS_InterruptOccurred() for a proper handling of the interrupt. So it
seems the OP should do something similar. Onl;y to deliver the custom
error you will have to do some other stuff. I don't know what but maybe
calling PyErr_SetString is sufficient as it might overwrite the
KeyboardInterrupt stuff.
This might be fixed in 0.6.3 - please confirm.
I need to add a test for this case.