Newbie help for using multiprocessing and subprocess packages for creating child processes

Piet van Oostrum piet at cs.uu.nl
Tue Jun 16 17:20:05 EDT 2009


>>>>> Matt <HellZFury+Python at gmail.com> (M) wrote:

>M> Try replacing:
>M>     cmd = [ "ls /path/to/file/"+staname+"_info.pf" ]
>M> with:
>M>     cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ]

In addition I would like to remark that -- if the only thing you want to
do is to start up a new command with subprocess.Popen -- the use of the
multiprocessing package is overkill. You could use threads as well.

Moreover, if you don't expect any output from these processes and don't
supply input to them through pipes there isn't even a need for these
threads. You could just use os.wait() to wait for a child to finish and
then start a new process if necessary.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list