Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19207
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'script,': 0.07; '21,': 0.09; 'file-like': 0.09; 'subprocess': 0.09; 'tkinter': 0.09; 'output': 0.10; 'cc:addr:python-list': 0.15; 'behavior?': 0.16; 'runs.': 0.16; 'subject:subprocess': 0.16; 'wrote:': 0.16; 'once,': 0.18; 'jan': 0.19; 'cheers,': 0.20; 'trying': 0.20; 'cc:no real name:2**0': 0.21; 'result.': 0.21; 'header:In-Reply- To:1': 0.22; 'runs': 0.23; 'cc:2**0': 0.25; 'sat,': 0.25; 'pm,': 0.26; 'received:209.85.220': 0.27; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'yes.': 0.30; 'chris': 0.30; 'url:library': 0.30; 'object': 0.33; 'window': 0.35; 'url:python': 0.36; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'received:209': 0.39; 'expected': 0.39; 'subject:: ': 0.39; 'skip:\xc2 10': 0.74; '9:45': 0.84; 'sender:addr:chris': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc :x-gm-message-state:content-type:content-transfer-encoding; bh=XiFE0QtFwb2MMsm8+S3Qfrhws9dOKoaYZ8kW1vQGll0=; b=Iu7Ry9mvrh9fRpBfvIOtxQKtclxDiUXxxeiXIHv6NRYA9/X9ytt/kZ2bc3qVZE+uxM Uoign8tUWFu4ItqmrNDpTC3/BU6eBBkUTiY5/nwK9ulQb50oSHFwAWdSqr8za3NLRaPw xJ86xJfq7yny1lg3oDmMn9uEi7fjLEjZeUqsc= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <koNSq.6594$sA3.1810@newsfe01.iad> |
| References | <koNSq.6594$sA3.1810@newsfe01.iad> |
| Date | Sat, 21 Jan 2012 23:27:54 -0800 |
| X-Google-Sender-Auth | mPoUerR66ZpdaopQ28vfL93fYno |
| Subject | Re: bufsize in subprocess |
| From | Chris Rebert <clp2@rebertia.com> |
| To | yves@zioup.com |
| X-Gm-Message-State | ALoCoQleOWwDe5bqKoMYsM+Sk1R1KNbWx/p/VIabH/M40H5871c/YO+mzALiKWiu5gnU3zfdca+b |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.4920.1327217278.27778.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1327217278 news.xs4all.nl 6885 [2001:888:2000:d::a6]:35845 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19207 |
Show key headers only | View raw
On Sat, Jan 21, 2012 at 9:45 PM, <yves@zioup.com> wrote:
> Is this the expected behavior?
Yes. `.read()` [with no argument] on a file-like object reads until
EOF. See http://docs.python.org/library/stdtypes.html#file.read
> When I run this script, it reads only once, but I expected once per line
> with bufsize=1.
You want proc.stdout.readline().
http://docs.python.org/library/stdtypes.html#file.readline
> What I am trying to do is display the output of a slow process in a tkinter
> window as it runs. Right now, the process runs to completion, then display
> the result.
>
> import subprocess
>
> com = ['/bin/ls', '-l', '/usr/bin']
> with subprocess.Popen(com, bufsize=1, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT) as proc:
> print('out: ' + str(proc.stdout.read(), 'utf8'))
Cheers,
Chris
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
bufsize in subprocess yves@zioup.com - 2012-01-21 22:45 -0700
Re: bufsize in subprocess Chris Rebert <clp2@rebertia.com> - 2012-01-21 23:27 -0800
Re: bufsize in subprocess yves@zioup.com - 2012-01-22 09:43 -0700
Re: bufsize in subprocess yves@zioup.com - 2012-01-22 10:05 -0700
csiph-web