Interrupting Python

Peter Hansen peter at
Fri Sep 6 23:06:35 EDT 2002

Bob Easton wrote:
> Using in a command line environment works as you expect. When I
> hit Ctrl-Break, Windows displays "^C" and then a command prompt.  If I hit
> Ctrl-C, the exception handler catches it and displays the results as
> specified in catchCtlC/py
> However, my preferred execution environment is PythonWin, not a command
> prompt. There, neither Ctrl-break, not Ctrl-C have any effect.  That could
> easily be a bug with PythonWin.

Not a bug, I think.  The whole Ctrl-C/Ctrl-Break concept is only
meaningful for command-line ("console") programs, not GUI apps.
I don't use PythonWin, but my guess is it does not bother passing
ctrl-c on to the application, possibly by design.

Can't you just run it under the console?  What advantages do
you find by running it under PythonWin other than during

Also, have you looked at the msvcrt module and kbhit() ?


More information about the Python-list mailing list