Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'developer.': 0.07; 'subject:file': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapper': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Reading': 0.16; 'variable.': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'written': 0.21; 'header:User-Agent:1': 0.23; 'environment': 0.24; 'script': 0.25; 'switch': 0.26; 'header:X -Complaints-To:1': 0.27; 'code': 0.31; 'subject:the': 0.34; 'subject:from': 0.34; 'maintained': 0.36; 'possible': 0.36; 'application': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'such': 0.63; 'said:': 0.68; 'price': 0.69; 'otten': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Reading from sys.stdin reads the whole file in Date: Wed, 27 Aug 2014 11:31:45 +0200 Organization: None References: <53fd6a48$0$11111$c3e8da3@news.astraweb.com> <87a96qgwbl.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p57bda771.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409131921 news.xs4all.nl 2975 [2001:888:2000:d::a6]:47020 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77123 Marko Rauhamaa wrote: > Peter Otten <__peter__@web.de>: > >> In addition to what already has been said: you can switch off output >> buffering of stdout/stderr with >> >> python -u out.py >> >> or by setting the PYTHONUNBUFFERED environment variable. > > Very often such externalities are not in the control of the application > developer. Sometimes it's possible to use a wrapper script rather than to sprinkle your code with flush(). Sometimes the "offending" python script is not even written and maintained by you, and setting an environment variable may be a price you are willing to pay to keep it that way.