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
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to