Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Wolfgang Maier Newsgroups: comp.lang.python Subject: Re: Unbuffered stderr in Python 3 Date: Wed, 4 Nov 2015 09:19:42 +0100 Lines: 31 Message-ID: References: <5637165b$0$1505$c3e8da3$5496439d@news.astraweb.com> <874mh39lgu.fsf@fastmail.com> <56397921$0$11094$c3e8da3@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de dnu+vpFad8gRKVXLy2fx/wK7kbEzgD7/P9F1qDk+lxYw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'terminated': 0.07; 'considered,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stderr': 0.09; 'streams.': 0.09; 'output': 0.13; 'wed,': 0.15; 'file,': 0.15; 'wednesday': 0.15; 'newline."': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'case.': 0.18; '>>>': 0.20; '2015': 0.20; 'not,': 0.22; 'am,': 0.23; 'errors': 0.23; 'header:In-Reply- To:1': 0.24; 'url:bugs': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'skip:" 20': 0.26; 'oversight': 0.29; 'prints': 0.29; 'received:132': 0.29; 'code': 0.30; 'probably': 0.31; 'related': 0.32; 'url:python': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'stream': 0.33; 'nov': 0.35; 'unicode': 0.35; 'should': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'enough': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'your': 0.60; 'behavior': 0.61; 'show': 0.62; 'making': 0.62; 'course': 0.62; 'our': 0.64; '>>>>>': 0.66; 'fundamental': 0.66; 'unusual': 0.72; 'console,': 0.84; 'going?': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 132.230.194.237 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <56397921$0$11094$c3e8da3@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98212 On 04.11.2015 04:18, Steven D'Aprano wrote: > On Wednesday 04 November 2015 09:25, Terry Reedy wrote: > >> On 11/3/2015 10:42 AM, Chris Angelico wrote: >>> On Wed, Nov 4, 2015 at 2:00 AM, Random832 wrote: >>>> Nobody writes: >>>> >>>>> It's probably related to the fact that std{in,out,err} are Unicode >>>>> streams. >>>> >>>> There's no fundamental reason a Unicode stream should have to be line >>>> buffered. If it's "related", it's only in that an oversight was made in >>>> the course of making that change. >> >> The current behavior is not an 'oversight'. I was considered, decided, >> and revisited in https://bugs.python.org/issue13601. Guido: >> "Line-buffering should be good enough since in practice errors messages >> are always terminated by a newline." If not, print(part_line, >> file=sys.stderr, flush=True) works for the unusual case. > > This is one of the offending line from our code base: > > print('<4>Suspicious answer "{}"!'.format(answer), file=sys.stderr) > > So that ought to be terminated by a newline. And yet, the stderr output > doesn't show up until the program exits. > For me, that prints immediately. Where is your output going? Console, file, ...?