On Fri, Nov 14, 2014 at 12:36 AM, Cameron Simpson <c...@zip.com.au> wrote: > On 13Nov2014 15:48, satishmlm...@gmail.com <satishmlm...@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: > > Python 3.4.2 (default, Nov 5 2014, 21:19:51) > [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> for stream in (sys.stdin, sys.stdout, sys.stderr): > ... print(stream.fileno()) > ... > 0 > 1 > 2 > >>> > > In short, in 3.4.2 it just works.
Why do you think the Python version has anything to do with it? Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> for stream in (sys.stdin, sys.stdout, sys.stderr): ... print(stream.fileno()) ... 0 1 2 Clearly, in 2.7.6 it also "just works". -- https://mail.python.org/mailman/listinfo/python-list