killing a script

Hans Mulder hansmu at xs4all.nl
Fri Sep 9 12:13:45 CEST 2011


On 9/09/11 11:07:24, Steven D'Aprano wrote:
> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of
> script.py. While script.py is running, it receives the Ctrl-C, the calling
> process does not.

You misinterpret what you are seeing: the calling process *does* receive
the ctrl-C, it just chooses to ignore it.

This is documented behaviour of os.system.  It you don't want this, then
use the subprocess module, which does not behave this way.

-- HansM




More information about the Python-list mailing list