subprocess.Popen and thread module

Discussion in 'Python' started by Danny Wong (dannwong), Aug 10, 2011.

  1. 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.
    Danny Wong (dannwong), Aug 10, 2011
    #1
    1. Advertising

  2. 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
    Thomas Rachel, Aug 10, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Hudspeth
    Replies:
    2
    Views:
    287
    Fabio FZero
    Mar 15, 2007
  2. William Hudspeth
    Replies:
    1
    Views:
    387
    Sion Arrowsmith
    Mar 16, 2007
  3. Mathieu Prevot
    Replies:
    3
    Views:
    551
    Mathieu Prevot
    Jul 7, 2008
  4. Andrew
    Replies:
    3
    Views:
    143
    emile
    Nov 30, 2012
  5. Mark Lawrence

    Re: os.popen and the subprocess module

    Mark Lawrence, Nov 27, 2012, in forum: Python
    Replies:
    0
    Views:
    138
    Mark Lawrence
    Nov 27, 2012
Loading...

Share This Page