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


Groups > comp.lang.python > #80764

Re: fileno() not supported in Python 3.1

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'subject:not': 0.03; 'subject:Python': 0.06; 'sys': 0.07; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'workaround?': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; '(like': 0.30; 'converting': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '3.x': 0.31; 'file': 0.32; 'run': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'maybe': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'url:listinfo': 0.36; 'responsible': 0.36; 'url:org': 0.36; 'nov': 0.38; 'little': 0.38; 'skip:p 20': 0.39; 'url:mail': 0.40; 'read': 0.60; 'improved': 0.60; 'series': 0.66; 'nobody': 0.68; 'topic,': 0.81; '3.4': 0.84; 'joel': 0.91; 'to:addr:nobody': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iKY1Z/fwz32MdrUiKp1JrFGtxNLtu0nKObfKGBjQvTY=; b=u4o0HhK/7ZXm4P4Pmk6SCYlnXstQmTBx3OMHuH2g6hvnjM5Fzeef1sqrggWPo13rPA u8N2ho4bNdHx9pwnXMlzE4Nsf/4zQThfhLPhBctS6w9ydPG3VNK4lq1Eh20gPkOlWU7h +9Aw9bPAWhBR5toDcjfHy96Sipvi7kf5nh7h6Q18Z7QVeatJmyiwJrKT55vCUSzzoqBn iql28kl0N+Lh6A+qb5JN8EsLzgOigsCg8xrKw3HUvf0GWee1SqCrKRi7emN4RFbGbIOc iK7dITfFzBpXigE5rIkVsyMfOr9ha2mkp+rylR9C8O7fD63PUsMvRR5sPcYs58xvcL64 ViDQ==
MIME-Version 1.0
X-Received by 10.224.7.200 with SMTP id e8mr11730394qae.77.1415974184527; Fri, 14 Nov 2014 06:09:44 -0800 (PST)
In-Reply-To <pan.2014.11.14.13.59.28.822000@nowhere.invalid>
References <bcc9a923-4a68-45b2-9854-a6f750e71ee7@googlegroups.com> <pan.2014.11.14.13.59.28.822000@nowhere.invalid>
Date Fri, 14 Nov 2014 09:09:44 -0500
Subject Re: fileno() not supported in Python 3.1
From Joel Goldstick <joel.goldstick@gmail.com>
To Nobody <nobody@nowhere.invalid>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
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.15819.1415974187.18130.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415974187 news.xs4all.nl 2886 [2001:888:2000:d::a6]:34659
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80764

Show key headers only | View raw


On Fri, Nov 14, 2014 at 8:59 AM, Nobody <nobody@nowhere.invalid> wrote:
> On Thu, 13 Nov 2014 15:48:32 -0800, satishmlmlml wrote:
>
>> import sys
>> for stream in (sys.stdin, sys.stdout, sys.stderr):
>>            print(stream.fileno())
>>
>>
>> io.UnsupportedOperation: fileno
>>
>> Is there a workaround?
>
> Try:
>         sys.stdin.buffer.fileno()
>
> or maybe
>
>         sys.stdin.buffer.raw.fileno()
>
> In Python 3.x, sys.stdin isn't actually a "file", it's a TextIOWrapper
> around a BufferedReader around a file (io.FileIO).
>
> TextIOWrapper is responsible for converting a stream of bytes to a stream
> of (Unicode) characters. BufferedReader is responsible for buffering (like
> C stdio).
>
A little off topic, but why not upgrade to 3.4 if you are learning
python.  I run 2.7, but I've read that much has improved in the 3.x
series since 3.1
>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com

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