Capture Control-C in Python
Consider reading this page about handling exceptions.. It should help. As @abarnert has said, do sys.exit() after except KeyboardInterrupt:. Something like try: # DO THINGS except KeyboardInterrupt: # quit sys.exit() You can also use the built in exit() function, but as @eryksun pointed out, sys.exit is more reliable.