Interrupting Python

Bob Easton bob at eleaston.com
Sat Sep 7 06:32:24 EDT 2002


Yes Peter, it makes sense that PythonWin works that way by design. You are
also right about running from the command prompt after development/debug is
done.

For this particular program, using a file semaphore is ideal since I can
place it at the right point in the program to enable easy restart, something
not easily done with the random ctrl-break.

Thanks to all who helped clear the fog for me.

--
Bob Easton


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3d796d22 at news.sentex.net...
> Bob Easton wrote:
> > Using catchCtlC.py 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
> development?
>
> Also, have you looked at the msvcrt module and kbhit() ?
>
> -Peter
>





More information about the Python-list mailing list