How can I interrupt os.system(cmd)?

Mathias Waack M.Waack at gmx.de
Sun Nov 21 14:27:40 EST 2004


Carl wrote:
> What options do I have to control execution of external programs
> from Python?

You have the same options as your OS offers. At least under Unix you
can run a command by using one of the popen()-functions or using the
commands module (I would suggest the latter for you). All these
procedures give you the process id (pid) of the started process. You
can wait() for this process or you can control it by sending it
signals using the kill() function. The python docs contains all
information necessary to use these functions. Read the pages about
the modules os, popen and commands. Most of these functions should
be available under all OS. 

Mathias



More information about the Python-list mailing list