Search code examples
pythonkeyboardinterrupt

CTRL-C causes forrtl: error (200) rather than python KeyboardInterrupt exception


I'm trying to do the exact same thing as this question:

How to prevent a block of code from being interrupted by KeyboardInterrupt in Python? (sorry, not enough rep yet to post this as a comment there)

However both of the top answers posted there aren't working for me. When I hit CTRL+C with either of those solutions in place, the script still closes immediately with:

forrtl: error (200): program aborting due to control-C event

The code I'm working on is fairly long and includes quite a few imported modules. Am I correct to assume one of these modules is interfering with the normal behavior of KeyboardInterrupt? If so, how can I figure out which one?

(I'm running python 2.7.6, 32bit on Windows)

thanks.


Solution

  • Scipy was causing the problem. The link below provides a solution, note that this is not unique to scipy.stats, but also occurs with other scipy functions.

    Ctrl-C crashes Python after importing scipy.stats