How do I capture SIGINT in Python on Windows?
Question: (Similar to [this question](http://stackoverflow.com/questions/1112343/how-do-
i-capture-sigint-in-python))

On UNIX under Python 2.7, at the Python prompt:

    
    
     >>> import signal
     >>> def handler(signal, frame):
     ...     print 'welcome to the handler'
     ...
     >>> signal.signal(signal.SIGINT, handler)
     <built-in function default_int_handler>
    

I press ctrl-c

    
    
     >>> welcome to the handler
    
     >>>
    

On Windows:

    
    
     >>> import signal
     >>> def handler(signal, frame):
     ...     print 'welcome to the handler'
     ...
     >>> signal.signal(signal.SIGINT, handler)
     <built-in function default_int_handler>
    

Upon pressing ctrl-c:

    
    
     >>>
     KeyboardInterrupt
     >>>
    

I can verify that `handler` is being installed Python-side as the handler for
SIGINT (calling `signal.signal` a second timer returns my `handler`). How can
I capture SIGINT on Windows?


Answer: After opening [the bug](http://bugs.python.org/issue18040) upstream the root
cause of the problem was found and a patch was written. This patch won't be
going into the python 2.x series.

