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.

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

Chris Gascoyne, while struggling to program stuff on Microsoft Windows:
"I thought people said how bad it was just because they didn't like Microsoft."
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to