This is #1 in the series “It seems to be hard to make Python robust”. A robust program won’t crash malfunction when ctrl-c is pressed, it will abort down clealy if possible. This is important with multiprocessing programs, because naive code will actually hang when you try to interrupt it with ctrl-c.
SIGINT (the exception raised when you press ctrl-c) will raise an exception when I/O operations return. This is pretty annoying. This happens even on time.sleep().
The way around this to catch ctrl-c is to install a handler, and put try blocks around IO operations. Real code won’t ignore IOError like this, this is just a sample.
And the other other answer is to write your serious programs in C++ (or maybe Go)? I still like Python, but the effort to get to silky smooth reliability is erasing all the gains from using Python in the first place. The answer of course is to make C++ as easy to use as Python. That’s not a language issue, it’s an environment/packages issue.
Perl, Python and R should give incredible credit to CTAN (Comprehensive Tex Archive Network) for blazing the trail. That’s the real reason Perl became successful. Python lives more on its own merits but would still be somewhat neutered without PyPI.