subprocess.Popen instance hangs

Jerry Hill malaclypse2 at gmail.com
Fri Aug 30 11:38:58 EDT 2013


On Fri, Aug 30, 2013 at 11:32 AM, Tim Johnson <tim at 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



More information about the Python-list mailing list