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


Groups > comp.lang.python > #53302

Re: subprocess.Popen instance hangs

References <20130829183418.GE414@mail.akwebsoft.com> <mailman.377.1377824422.19984.python-list@python.org> <pan.2013.08.30.14.47.27.111000@nowhere.com> <20130830153229.GC400@mail.akwebsoft.com>
Date 2013-08-30 11:38 -0400
Subject Re: subprocess.Popen instance hangs
From Jerry Hill <malaclypse2@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.391.1377877489.19984.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Aug 30, 2013 at 11:32 AM, Tim Johnson <tim@akwebsoft.com> wrote:
>   The objective is to display all output, but to also separate error
>   messages from normal output.

I still think you want to use communicate().  Like this:

p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
output, err = p.communicate()

That's it.  No need for a loop, or manually handling the fact that
stderr and/or stdout could end up with a full buffer and start to
block.

-- 
Jerry

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


Thread

Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-29 17:00 -0800
  Re: subprocess.Popen instance hangs Nobody <nobody@nowhere.com> - 2013-08-30 15:47 +0100
    Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-30 07:32 -0800
    Re: subprocess.Popen instance hangs Jerry Hill <malaclypse2@gmail.com> - 2013-08-30 11:38 -0400
    Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-30 10:43 -0800

csiph-web