I use this:
#another: while not self.quit:
If I want it to be more reliable, let's say we go out and have errors:
except KeyboardInterrupt: another.quit = True signal.alarm(5) time.sleep(6)
A side effect for this is that every block where you are except: or except Exception, e: (which is not something that you should do anyway / a lot), you need to add except KeyboardInterrupt: raise so that the exception does not was "eaten".
Dima tisnek
source share