fileno() not supported in Python 3.1
Cameron Simpson
cs at zip.com.au
Fri Nov 14 02:36:46 EST 2014
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:
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 <cs at 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."
More information about the Python-list
mailing list