sys.stdin.read question

It's me itsme at yahoo.com
Tue Dec 7 22:46:27 CET 2004


"Grant Edwards" <grante at visi.com> wrote in message
news:41b62008$0$9746$a1866201 at visi.com...
> On 2004-12-07, It's me <itsme at yahoo.com> wrote:
> > Why do I get an "AttributeError: read" message when I do:
> >
> >     import sys
> >     r=sys.stdin.read()
>
> Dunno. Works fine for me under 2.3.4, and according to the
> docs, should work under 2.4.
>
> What do you get when you do this:
>
>  import sys

Done that.

>  type(sys.stdin)

I get:

    <type 'instance'>

>  dir(sys.stdin)

I get:

['_RPCProxy__attributes', '_RPCProxy__getattributes',
'_RPCProxy__getmethods', '_RPCProxy__methods', '__doc__', '__getattr__',
'__init__', '__module__', 'encoding', 'oid', 'sockio']

>
> > Some sample code I saw uses this function in the same manner I
> > am and so I am assuming this is the correct syntax?
>
> Should be.
>
> > Or is this a bug in Python 2.4?
>
> That would be a little hard to believe.
>

Well, here's a copy from the Python Shell output:

>>> print sys.stdin.read(5)

Traceback (most recent call last):
  File "<pyshell#26>", line 1, in -toplevel-
    print sys.stdin.read(5)
AttributeError: read
>>>

????????





More information about the Python-list mailing list