subprocess.Popen and thread module

Danny Wong (dannwong) dannwong at cisco.com
Wed Aug 10 02:48:36 EDT 2011


Hi Chris,
Here is the code,
    try:
        cmd_output = subprocess.Popen(['scm', 'load', '--force', '-r', nickname, '-d', directory, project], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        status = cmd_output.wait()
        print "In load status is: %s" % status + "\n"
    except:
        print "Error Executing %s" % command + "\n"


-----Original Message-----
From: chris at rebertia.com [mailto:chris at rebertia.com] On Behalf Of Chris Rebert
Sent: Tuesday, August 09, 2011 11:47 PM
To: Danny Wong (dannwong)
Cc: python-list at python.org
Subject: Re: subprocess.Popen and thread module

On Tue, Aug 9, 2011 at 11:38 PM, Danny Wong (dannwong)
<dannwong at cisco.com> wrote:
> 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.

What's your Popen() call look like?

Cheers,
Chris


More information about the Python-list mailing list