classification
Title: sys.stdin.fileno() gives attribute error in IDLE
Type: behavior Stage: resolved
Components: IDLE Versions: Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: kbk Nosy List: ajaksu2, gpolo, kbk, markveldhuis
Priority: normal Keywords:

Created on 2008-05-29 16:43 by markveldhuis, last changed 2009-05-18 05:10 by kbk. This issue is now closed.

Messages (3)
msg67503 - (view) Author: Mark Veldhuis (markveldhuis) Date: 2008-05-29 16:43
I am using IDLE on Ubuntu Hardy (8.04) and all in all very content to
use it. Today I got an AttributeError using sys.stdin.fileno(). A closer
look revealed this:

in IDLE:

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
    
IDLE 1.2.2      
>>> import sys
>>> dir(sys.stdin)
['_RPCProxy__attributes', '_RPCProxy__getattributes',
'_RPCProxy__getmethods', '_RPCProxy__methods', '__class__',
'__delattr__', '__dict__', '__doc__', '__getattr__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__',
'encoding', 'oid', 'sockio']
>>> 

in terminal:

:~$ python
Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> dir(sys.stdin)
['__class__', '__delattr__', '__doc__', '__enter__', '__exit__',
'__getattribute__', '__hash__', '__init__', '__iter__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
'close', 'closed', 'encoding', 'fileno', 'flush', 'isatty', 'mode',
'name', 'newlines', 'next', 'read', 'readinto', 'readline', 'readlines',
'seek', 'softspace', 'tell', 'truncate', 'write', 'writelines',
'xreadlines']
>>> 

I expected to see more or less the same output, is that right? I could
not find information on this online, so I report it as a bug. 

greetings, Mark
msg86614 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-04-26 22:11
I think this isn't a bug, but an implementation detail. Guilherme?
msg88015 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-05-18 05:09
>>> type(sys.stdin)
<class 'idlelib.rpc.RPCProxy'>

Don't attempt  sys.stdin._RPCProxy_methods lest you be turned to 
stone ;-)

We didn't implement all the features of stdin as it didn't seem 
necessary.  Did you have a specific reason to access 
stdin.fileno() ?

stdin/out/err support communications between the subprocess and 
the IDLE GUI through a socket.  They are redirected in the GUI and 
proxied in the subprocess.
History
Date User Action Args
2009-05-18 05:10:00kbksetstatus: open -> closed

assignee: kbk

nosy: + kbk
messages: + msg88015
resolution: works for me
stage: test needed -> resolved
2009-04-26 22:11:49ajaksu2setpriority: normal

type: behavior
versions: + Python 2.6, - Python 2.5
nosy: + ajaksu2, gpolo

messages: + msg86614
stage: test needed
2008-05-29 16:43:55markveldhuiscreate