August 7th, 2013, 08:35 AM
Difference between IDLE and cmd python 3.3 win
Hey I noticed something that confused me a bit. When checking stream fileno() with this code
when using it on command line it works fines and returns the numbers 0,1,2 but when run using idle it returns the error
>>>for stream in (sys.stdin, sys.stdout, sys.stderr):
Does anyone know why this hapens?
Traceback (most recent call last):
File "<pyshell#3>", line 2, in <module>
August 8th, 2013, 11:07 AM
If you just type
in IDLE, you'll notice its type is "<idlelib.PyShell.PseudoInputFile object>". If you think about how IDLE operates, it makes sense that it has to define its own stdin/stdout/stderr objects, so that I/O can be done through its GUI rather than the calling shell.
For whatever reason, the fileno operation wasn't defined in these objects.