Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8631
| References | <4E096D3B.3080300@gmail.com> <iubshf$dus$1@dough.gmane.org> <mailman.532.1309484420.1164.python-list@python.org> <iujsrg$qe3$1@solani.org> <4E0D7F08.4080207@gmail.com> |
|---|---|
| Date | 2011-07-01 01:24 -0700 |
| Subject | Re: Trying to chain processes together on a pipeline |
| From | Chris Rebert <clp2@rebertia.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.539.1309508695.1164.python-list@python.org> (permalink) |
On Fri, Jul 1, 2011 at 1:02 AM, Andrew Berg <bahamutzero8825@gmail.com> wrote: > On 2011.07.01 02:26 AM, Peter Otten wrote: >> I can't reproduce your setup, but I'd try using communicate() instead of >> wait() and close(). > I don't really know what communicate() does. "Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate." It then returns the read data as two strings. It's pretty straightforward. > The docs don't give much > info or any examples (that explain communicate() anyway), and don't say > when communicate() is useful. They are slightly roundabout in that respect. The warnings for .wait() and .stdout/err explain communicate()'s utility: "Warning: This will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. ***Use communicate() to avoid that.***" [emphasis added] Cheers, Chris -- http://rebertia.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Trying to chain processes together on a pipeline Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-30 20:40 -0500
Re: Trying to chain processes together on a pipeline Peter Otten <__peter__@web.de> - 2011-07-01 09:26 +0200
Re: Trying to chain processes together on a pipeline Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-01 03:02 -0500
Re: Trying to chain processes together on a pipeline Chris Rebert <clp2@rebertia.com> - 2011-07-01 01:24 -0700
csiph-web