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

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top