Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80745

Re: fileno() not supported in Python 3.1

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 <cameron@cskk.homeip.net>
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 <cs@zip.com.au>
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 <bcc9a923-4a68-45b2-9854-a6f750e71ee7@googlegroups.com>
User-Agent Mutt/1.5.23 (2014-03-12)
References <bcc9a923-4a68-45b2-9854-a6f750e71ee7@googlegroups.com>
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15812.1415950612.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 13Nov2014 15:48, satishmlmlml@gmail.com <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 <cs@zip.com.au>

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."

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

fileno() not supported in Python 3.1 satishmlmlml@gmail.com - 2014-11-13 15:48 -0800
  Re: fileno() not supported in Python 3.1 Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 10:57 +1100
    Re: fileno() not supported in Python 3.1 satishmlmlml@gmail.com - 2014-11-13 16:08 -0800
      Re: fileno() not supported in Python 3.1 Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 13:52 +1100
  Re: fileno() not supported in Python 3.1 Cameron Simpson <cs@zip.com.au> - 2014-11-14 18:36 +1100
  Re: fileno() not supported in Python 3.1 Nobody <nobody@nowhere.invalid> - 2014-11-14 13:59 +0000
    Re: fileno() not supported in Python 3.1 Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-14 09:09 -0500
  Re: fileno() not supported in Python 3.1 Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-14 09:51 -0700
    Re: fileno() not supported in Python 3.1 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 22:23 +1100
  Re: fileno() not supported in Python 3.1 Dan Stromberg <drsalists@gmail.com> - 2014-11-15 21:25 -0800
  Re: fileno() not supported in Python 3.1 Chris Angelico <rosuav@gmail.com> - 2014-11-16 16:29 +1100

csiph-web