Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52839
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'output': 0.05; 'root': 0.05; 'suddenly': 0.07; 'parameter': 0.09; 'ping': 0.09; 'subject:command': 0.09; 'python': 0.11; 'windows': 0.15; '23,': 0.16; 'block.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:program': 0.16; 'wrote:': 0.18; 'producing': 0.19; 'work,': 0.20; 'command': 0.22; 'appears': 0.22; 'aug': 0.22; 'directory.': 0.24; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'chris': 0.29; 'am,': 0.29; 'unix': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; '"please': 0.31; 'are.': 0.31; 'fine,': 0.31; 'go.': 0.31; 'run': 0.32; 'says': 0.33; 'worked': 0.33; 'everyone': 0.33; 'fri,': 0.33; 'not.': 0.33; 'subject:the': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'searching': 0.37; 'too': 0.37; 'window': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'anything': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'slowly': 0.60; "you're": 0.61; 'more': 0.64; 'programs,': 0.74; 'console,': 0.84; 'utilities,': 0.84; 'have.': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Wjg2sKh+D314jp9DhZByRmLVqiib+bVRw37dAB9HVNY=; b=WiTPwR27mzv+Ney0zhXbj/LlHq3i+EOCI5A1VF5At786EAZ1C98t+vV7yFy3+GE9kU j2+XYo4FjF5WCJEJnF+JhCKcHJwdLUME/mTy0ukZMvOkrECLRvlnTfZmK1sgcgebuttE yIYWCGjbZDBp3fNgAVp2h9fTEpEhr8MKF1gSOEQhFsfhvrGlauMtdRE+DSSfJWMf67Kh bqUHVC6g8bPwqy3tCqw0TMXO2NTa4/P6M9PcqGbNAKHc4G4mmbBFbyBIt/bTXJVqn79/ PLyYnMp2OhKrGrL8e7hvHR7XbrZoRfDq0KaniUVqLoChvt6RX+uEolUXO2X4cMvSQZl9 fANw== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.233.173 with SMTP id tx13mr853992vec.31.1377185592318; Thu, 22 Aug 2013 08:33:12 -0700 (PDT) |
| In-Reply-To | <52162da8$0$29987$c3e8da3$5496439d@news.astraweb.com> |
| References | <5215a6cf$0$6512$c3e8da3$5496439d@news.astraweb.com> <mailman.119.1377152952.19984.python-list@python.org> <52162da8$0$29987$c3e8da3$5496439d@news.astraweb.com> |
| Date | Fri, 23 Aug 2013 01:33:12 +1000 |
| Subject | Re: Running a command line program and reading the result as it runs |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.136.1377185595.19984.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377185595 news.xs4all.nl 15902 [2001:888:2000:d::a6]:55354 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52839 |
Show key headers only | View raw
On Fri, Aug 23, 2013 at 1:26 AM, Ian Simcock <Ian.Simcock@internode.on.net> wrote: > Chris Angelico wrote: >> >> Is the program actually producing output progressively? I just tried >> your exact code with "dir /ad /s /b" and it worked fine, producing >> output while the dir was still spinning (obviously setting shell=True >> to make that work, but I don't think that'll make a difference). It >> may be that pip buffers its output. Is there a parameter to pip to >> make it pipe-compatible? >> >> ChrisA >> > > If I run pip in the command window I can see it's output appearing line by > line rather than on one block. > > I tried the code with the dir command but it's too fast for me to be sure if > it's working or not. > > I tried again using the command "ping google.com" instead since I know that > output's slowly and it something that everyone should have. In the command > window I can see that the output appears over time, but from python I get > nothing for a while and then suddenly get all the output in one rapid go. > > > Can you think of anything else I can look at? A lot of programs, when their output is not going to the console, will buffer output. It's more efficient for many purposes. With Unix utilities, there's often a parameter like --pipe or --unbuffered that says "please produce output line by line", but Windows ping doesn't have that - and so I'm seeing the same thing you are. You should be able to see the time delay in dir by looking for some particular directory name, and searching from the root directory. Unless you're on a BLAZINGLY fast drive, that'll take Windows a good while! ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Running a command line program and reading the result as it runs Ian Simcock <Ian.Simcock@Internode.on.net> - 2013-08-22 15:21 +0930
Re: Running a command line program and reading the result as it runs Chris Angelico <rosuav@gmail.com> - 2013-08-22 16:22 +1000
Re: Running a command line program and reading the result as it runs Ian Simcock <Ian.Simcock@Internode.on.net> - 2013-08-23 00:56 +0930
Re: Running a command line program and reading the result as it runs Chris Angelico <rosuav@gmail.com> - 2013-08-23 01:33 +1000
Re: Running a command line program and reading the result as it runs Ian Simcock <Ian.Simcock@Internode.on.net> - 2013-08-23 16:22 +0930
Re: Running a command line program and reading the result as it runs Grant Edwards <invalid@invalid.invalid> - 2013-08-23 14:02 +0000
Re: Running a command line program and reading the result as it runs Rob Wolfe <rw@smsnet.pl> - 2013-08-22 23:14 +0200
Re: Running a command line program and reading the result as it runs Ian Simcock <Ian.Simcock@Internode.on.net> - 2013-08-23 16:31 +0930
Re: Running a command line program and reading the result as it runs Gertjan Klein <gklein@xs4all.nl> - 2013-08-23 11:32 +0200
Re: Running a command line program and reading the result as it runs Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-23 11:53 +0200
Re: Running a command line program and reading the result as it runs Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-23 12:34 +0200
RE: Running a command line program and reading the result as it runs "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-23 10:50 +0000
Re: Running a command line program and reading the result as it runs Peter Otten <__peter__@web.de> - 2013-08-23 13:14 +0200
Re: Running a command line program and reading the result as it runs Gertjan Klein <gklein@xs4all.nl> - 2013-08-23 14:03 +0200
Re: Running a command line program and reading the result as it runs Ian Simcock <Ian.Simcock@Internode.on.net> - 2013-08-24 19:06 +0930
Re: Running a command line program and reading the result as it runs random832@fastmail.us - 2013-08-23 12:04 -0400
Re: Running a command line program and reading the result as it runs Peter Otten <__peter__@web.de> - 2013-08-23 18:39 +0200
csiph-web