Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53254

Re: subprocess.Popen instance hangs

From xDog Walker <thudfoo@gmail.com>
Subject Re: subprocess.Popen instance hangs
Date 2013-08-29 13:26 -0700
References <20130829183418.GE414@mail.akwebsoft.com>
Newsgroups comp.lang.python
Message-ID <mailman.370.1377808009.19984.python-list@python.org> (permalink)

Show all headers | View raw


On Thursday 2013 August 29 11:34, Tim Johnson wrote:
> using Python 2.7.1 on OS X 10.7.5
>
> I'm managing a process of drush using an instance of subprocess.Popen
>
> The process has a '--verbose' option. When that option is passed as
> part of the initializer `args' argument, the process will hang.
>
> It should be no surprise as drush output with the --verbose option
> can be _extremely_ verbose, and I can do without it, but I would
> like to learn how to handle it. I've googled this topic, but my poor
> little brain is yet to sort out all of the content found.
>
> ## my relevant code follows :
> p = subprocess.Popen(args,stderr=subprocess.STDOUT,stdout=subprocess.PIPE)
> ## wait() is 'forever' if '--verbose' used
> exit_status = p.wait()
> output = p.stdout.read()
> ## done

p = subprocess.Popen(args,stderr=subprocess.STDOUT,stdout=subprocess.PIPE)
for line in p.stdout:
    do_something(line)
p.wait()

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: subprocess.Popen instance hangs xDog Walker <thudfoo@gmail.com> - 2013-08-29 13:26 -0700

csiph-web