Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!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; 'python.': 0.02; 'subject:not': 0.03; 'subject:Python': 0.06; 'sys': 0.07; 'works.': 0.09; 'python': 0.11; '6.0': 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; 'simpson': 0.16; 'skip:> 20': 0.16; 'windows:': 0.16; 'workaround?': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'cheers,': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'workaround': 0.31; 'compatible': 0.32; 'stuff': 0.32; 'there': 0.35; 'received:com.au': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'apple': 0.38; 'nov': 0.38; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'first': 0.61; 'content-disposition:inline': 0.62; 'email addr:gmail.com': 0.63; 'more': 0.64; '2014,': 0.84; '4.2.1': 0.84; 'short,': 0.84 Date: Fri, 14 Nov 2014 18:36:46 +1100 From: Cameron Simpson To: python-list@python.org Subject: Re: fileno() not supported in Python 3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=J0QyKEt1u0cA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=pGLkceISAAAA:8 a=aesfJ5f_FvJjdqWLI8IA:9 a=CjuIK1q_8ugA: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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415950612 news.xs4all.nl 2852 [2001:888:2000:d::a6]:51504 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80745 On 13Nov2014 15:48, satishmlmlml@gmail.com wrote: >import sys >for stream in (sys.stdin, sys.stdout, sys.stderr): > print(stream.fileno()) > > >io.UnsupportedOperation: fileno > >Is there a workaround? The first workaround that suggests itself it to use a more modern Python. I've got 3.4.2 here, and it goes: Python 3.4.2 (default, Nov 5 2014, 21:19:51) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> for stream in (sys.stdin, sys.stdout, sys.stderr): ... print(stream.fileno()) ... 0 1 2 >>> In short, in 3.4.2 it just works. Cheers, Cameron Simpson Chris Gascoyne, while struggling to program stuff on Microsoft Windows: "I thought people said how bad it was just because they didn't like Microsoft."