subprocess.Popen and thread module

  • Thread starter Danny Wong (dannwong)
  • Start date
D

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? If not, what other module should I use
to perform a system call? I also, want to log stdout and stderr to a
file. Thanks.
 
T

Thomas Rachel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top