Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'api': 0.11; 'python': 0.11; "wouldn't": 0.14; '>on': 0.16; 'discarded.': 0.16; 'flush': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'roy': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'input': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'cheers,': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; '+0100,': 0.31; 'fri,': 0.33; "can't": 0.35; 'but': 0.35; 'received:com.au': 0.36; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'most': 0.60; 'lost': 0.61; 'content-disposition:inline': 0.62; 'account': 0.65; 'fire': 0.65; 'needs,': 0.65; 'nobody': 0.68; 'memories': 0.84; 'ships': 0.84; 'streams': 0.84; 'shoulder': 0.91; 'watched': 0.91 Date: Sun, 19 Oct 2014 08:01:11 +1100 From: Cameron Simpson To: python-list@python.org Subject: Re: Flush stdin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=r5UFkecV8NkA:10 a=IkcTkHD0fZMA:10 a=vrnE16BAAAAA:8 a=AdnIQGEx3bcDsBmIEi0A:9 a=QEXdDO2ut3YA:10 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413667595 news.xs4all.nl 2906 [2001:888:2000:d::a6]:53161 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79279 On 18Oct2014 17:55, Nobody wrote: >On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote: >> I am using netcat to listen to a port and python to read stdin and print >> to the console. >> >> nc -l 2003 | python print_metrics.py >> >> sys.stdin.flush() doesn’t seem to flush stdin, > >You can't "flush" an input stream. Sure you can. Most streams are read through an API which buffers. That buffer can be discarded. I'm not sure it is what the OP needs, but it is not a nonsensical idea. Cheers, Cameron Simpson I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I've watched C-beams glitter in the dark near the Tannhauser Gate. All these memories will be lost in time, like tears in rain. - Roy Baty, _Blade Runner_