subprocess.Popen and thread module

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Wed Aug 10 06:09:52 EDT 2011


Am 10.08.2011 08:38 schrieb Danny Wong (dannwong):
> Hi All,
>     I'm trying to execute some external commands from multiple database.
> I'm using threads and subprocess.Popen ( from docs, all the popen*
> functions are deprecated and I was told to use subprocess.Popen) to
> execute the external commands in parallel, but the commands seems to
> hang.
> My question is:
> Is subprocess.Popen thread safe?

Do you really need threads here? As you just run those external commands 
(as far as I understand), it might be enough to start the commands, hold 
their object, read them out (maybe part for part) and then wait().


Thomas



More information about the Python-list mailing list