fileno() not supported in Python 3.1

Cameron Simpson cs at zip.com.au
Sat Nov 15 03:39:58 CET 2014


On 14Nov2014 09:51, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>On Fri, Nov 14, 2014 at 12:36 AM, Cameron Simpson <cs at zip.com.au> wrote:
>> On 13Nov2014 15:48, satishmlmlml at gmail.com <satishmlmlml at 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: [... works just fine ...]
>
>Why do you think the Python version has anything to do with it?
>Python 2.7.6 (default, Mar 22 2014, 22:59:56) [... works just fine ...]
>Clearly, in 2.7.6 it also "just works".

Yeah, true.

I think the consensus is now that the OP is using some kind of IDE where the IO 
streams are not connected to terminals or other real OS-level files, but to 
stream abstractions delivering the the IDE display widgetry. Thus no .fileno() 
facility, because there is no OS-level file.

But we have yet to obtain that information from the OP.

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

That's about as good as when one of my students left me a note signed
'anon.'--written on personalized stationery.
        - Ayse Sercan <ayse at netcom.com>



More information about the Python-list mailing list