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


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to