io.UnsupportedOperation: fileno

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Fri Nov 14 12:29:17 CET 2014


Am 14.11.2014 00:42 schrieb satishmlmlml at gmail.com:
> fileno() in not supported. Is it only in 3.1? What is the workaround?

You have been asked many times about the details of your environment.

Especially, you have been told that it is important to know if you 
directly use the Python CLI or some GUI like IDLE.

I just tested the latter thing and found out that it indeed makes a 
difference, as it introduces a replacement for the std* stuff you are 
missing:

 >>> sys.stdin
<idlelib.PyShell.PseudoInputFile object at 0x0000000002EAD588>
 >>> sys.stdout
<idlelib.PyShell.PseudoOutputFile object at 0x0000000002EAD5C0>
 >>> sys.stderr
<idlelib.PyShell.PseudoOutputFile object at 0x0000000002EAD5F8>

Calling .fileno() on such a Pseudo*File just raises an 
UnsupportedOperation exception.

This is in contrast to using the CLI directly.



More information about the Python-list mailing list