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


Groups > comp.lang.python > #80742

Re: fileno() not supported in Python 3.1

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; 'subject:not': 0.03; 'subject:Python': 0.06; 'important,': 0.07; 'abstraction': 0.09; 'alain': 0.09; 'formatting': 0.09; 'descriptor': 0.16; 'finney': 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; 'stderr': 0.16; 'sys.stderr': 0.16; 'sys.stdout': 0.16; 'thead': 0.16; 'transcript': 0.16; 'tty': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'file,': 0.19; 'seems': 0.21; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'cheers,': 0.24; 'question': 0.24; 'van': 0.27; 'header:In-Reply- To:1': 0.27; 'fault': 0.31; 'writes:': 0.31; 'file': 0.32; 'regular': 0.32; '"the': 0.34; 'core': 0.34; 'basic': 0.35; "can't": 0.35; 'but': 0.35; 'choosing': 0.36; 'received:com.au': 0.36; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'expressed': 0.37; 'ben': 0.38; 'ends': 0.38; 'received:211': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'unable': 0.39; 'how': 0.40; 'even': 0.60; 'simple': 0.61; 'content-disposition:inline': 0.62; 'email addr:gmail.com': 0.63; 'world': 0.66; 'default': 0.69; 'opinions': 0.70; 'special': 0.74; 'intending': 0.84; 'approach.': 0.91
Date Fri, 14 Nov 2014 17:31:32 +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 <85a93u4hpg.fsf@benfinney.id.au>
User-Agent Mutt/1.5.23 (2014-03-12)
References <85a93u4hpg.fsf@benfinney.id.au>
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=ygr8jC7gAAAA:8 a=mTK-mDNeb6rDuBdexUgA:9 a=YiH_0_V2r_3p8kGg:21 a=RrJBh5QgdZu-UMxK:21 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.15810.1415948559.18130.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415948559 news.xs4all.nl 2885 [2001:888:2000:d::a6]:42448
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:80742

Show key headers only | View raw


On 14Nov2014 13:52, Ben Finney <ben+python@benfinney.id.au> wrote:
>satishmlmlml@gmail.com writes:
>> How to get file descriptor number for the following:
>> sys.stdin
>> sys.stdout
>> sys.stderr
>
>Why do you need this? What are you intending to do?

In fairness, who cares? It is a basic and reasonable thing to do. I did it only 
last night: I wanted to know if stderr was a tty or pipe, versus a regular 
file, as I wanted to special case some error formatting (loosely speaking, 
default automatic people-friendliness versus log file verbosity).

I know that why people want to do things is important, as they may be choosing 
the wrong approach. But the above question seems very simple and very basic: he 
seems unable to get the OS file descriptor number from the standard streams, 
and this is surprising.

I think he even started the thead with almost a transcript of the failure, and 
backed off the the above abstraction when someone complained.

Cheers,
Cameron Simpson <cs@zip.com.au>

| Alain van der Heide                      |  This is the way the world ends  |
| avdh@dazixco.ingr.com                    |  This is the way the world ends  |
| "The opinions expressed above are mine-  |  This is the way the world ends  |
| mineminemine, and you can't have them."  |  Not with a bang, but with a whi

segmentation fault
core dumped

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


Thread

Re: fileno() not supported in Python 3.1 Cameron Simpson <cs@zip.com.au> - 2014-11-14 17:31 +1100

csiph-web