newbie help: best way manage subprocesses

Gerhard Häring gh at ghaering.de
Fri Mar 28 09:12:15 EST 2003


Paul Sherwood <p.sherwood at dl.ac.uk> wrote:
> Hi,
> 
> Could someone give me some pointers to the best way of managing
> subprocesses on UNIX and Windows.
> 
> I am currently using variants of os.popen called from a thread
> created by threading.Thread() but as far as I can see there is no
> obvious way to destroy a thread (or the process it controls) if the
> command it is running does not complete as expected.
> 
> If I use the variants of os.spawn I can run the new processes in the
> background and manage them using the PID that is returned but in
> this case I don't have file descriptors for stdout and stderr, which
> I would like to manipulate. [...]

Looks like popen2.Popen3 might be what you want. Unfortunately, it
doesn't seem to be available on Windows, only on Unix.

-- Gerhard




More information about the Python-list mailing list