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


Groups > comp.lang.python > #47626 > unrolled thread

RE: Popen and reading stdout in windows

Started by"Joseph L. Casale" <jcasale@activenetwerx.com>
First post2013-06-11 01:50 +0000
Last post2013-06-11 10:54 +0100
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: Popen and reading stdout in windows "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-06-11 01:50 +0000
    Re: Popen and reading stdout in windows Pete Forman <petef4+usenet@gmail.com> - 2013-06-11 08:18 +0100
      Re: Popen and reading stdout in windows Chris Rebert <clp2@rebertia.com> - 2013-06-11 00:26 -0700
    RE: Popen and reading stdout in windows Nobody <nobody@nowhere.com> - 2013-06-11 10:54 +0100

#47626 — RE: Popen and reading stdout in windows

From"Joseph L. Casale" <jcasale@activenetwerx.com>
Date2013-06-11 01:50 +0000
SubjectRE: Popen and reading stdout in windows
Message-ID<mailman.3005.1370915497.3114.python-list@python.org>
> You leave out an awful amount of detail.  I have no idea what ST is, so
> I'll have to guess your real problem.

Ugh, sorry guys its been one of those days, the post was rather useless...

I am using Popen to run the exe with communicate() and I have sent stdout to PIPE
without luck. Just not sure what is the proper way to iterate over the stdout as it eventually
makes its way from the buffer.

Thanks!
jlc

[toc] | [next] | [standalone]


#47644

FromPete Forman <petef4+usenet@gmail.com>
Date2013-06-11 08:18 +0100
Message-ID<867gi12jzw.fsf@gmail.com>
In reply to#47626
"Joseph L. Casale" <jcasale@activenetwerx.com> writes:

>> You leave out an awful amount of detail. I have no idea what ST is,
>> so I'll have to guess your real problem.
>
> Ugh, sorry guys its been one of those days, the post was rather
> useless...
>
> I am using Popen to run the exe with communicate() and I have sent
> stdout to PIPE without luck. Just not sure what is the proper way to
> iterate over the stdout as it eventually makes its way from the
> buffer.

You could try Sarge which is a wrapper for subprocess providing command
pipeline functionality.

http://sarge.readthedocs.org/

-- 
Pete Forman

[toc] | [prev] | [next] | [standalone]


#47648

FromChris Rebert <clp2@rebertia.com>
Date2013-06-11 00:26 -0700
Message-ID<mailman.3012.1370935608.3114.python-list@python.org>
In reply to#47644

[Multipart message — attachments visible in raw view] — view raw

On Jun 11, 2013 12:21 AM, "Pete Forman" <petef4+usenet@gmail.com> wrote:
>
> "Joseph L. Casale" <jcasale@activenetwerx.com> writes:
>
> >> You leave out an awful amount of detail. I have no idea what ST is,
> >> so I'll have to guess your real problem.
> >
> > Ugh, sorry guys its been one of those days, the post was rather
> > useless...
> >
> > I am using Popen to run the exe with communicate() and I have sent
> > stdout to PIPE without luck. Just not sure what is the proper way to
> > iterate over the stdout as it eventually makes its way from the
> > buffer.
>
> You could try Sarge which is a wrapper for subprocess providing command
> pipeline functionality.
>
> http://sarge.readthedocs.org/

Or Plumbum: http://plumbum.readthedocs.org

Cheers,
Chris

[toc] | [prev] | [next] | [standalone]


#47651

FromNobody <nobody@nowhere.com>
Date2013-06-11 10:54 +0100
Message-ID<pan.2013.06.11.09.54.03.899000@nowhere.com>
In reply to#47626
On Tue, 11 Jun 2013 01:50:07 +0000, Joseph L. Casale wrote:

> I am using Popen to run the exe with communicate() and I have sent stdout
> to PIPE without luck. Just not sure what is the proper way to iterate over
> the stdout as it eventually makes its way from the buffer.

The proper way is:

	p = subprocess.Popen(..., stdout=subprocess.PIPE)
	for line in p.stdout:
	    # use 'line'
	p.wait()

If the program uses stdin, matters get more complicated.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web