read from standard input

Bujji sivaits4u at gmail.com
Sat Dec 5 06:40:16 EST 2009


what is the problem you faced in running it on Linux or windows
we'll use IDLE only

on linux platform like this also you can run see below
ubuntu at siva:~/Desktop$ python
Python 2.6.2 (r262:71600, Oct  7 2009, 11:27:27)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> data=sys.stdin.read()
hello world
this is a test     (give Cntrl D to exit)
>>> print data
hello world
this is a test

>>>

(I can put data into some other file as well)
This is working very well on my PC

It should work same on the windows too.
but I don't know why its is failing, and thats what i want to know.
If any other solution is there let know to get it work on windows ( python
IDLE)
welcome


Thanks,
Siva

On Sat, Dec 5, 2009 at 3:44 PM, Rami Chowdhury <rami.chowdhury at gmail.com>wrote:

> On Saturday 05 December 2009 01:20:12 Siva B wrote:
> > for the line of code you given,
> >
> > print type(sys.stdin), sys.stdin
> >
> > the output is:
> > <class 'idlelib.rpc.RPCProxy'> <idlelib.rpc.RPCProxy object at
> >  0x00BE8090>
> >
> > there is no change.
> > I have tried it in  python2.6 on windows platform.
> >
> > Thanks,
> > Siva
> >
>
> How did you run this on Linux? How did you run it on Windows? It looks
> like you're running it from within IDLE. I don't know IDLE at all, and
> don't know how to pass data to its standard input -- can you let us know
> what arguments you're using?
>
> I've tried sys.stdin.read() from inside IDLE on Linux, and it gives me
> the same error.
>
>
> ----
> Rami Chowdhury
> "Any sufficiently advanced incompetence is indistinguishable from
> malice." -- Grey's Law
> 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091205/8b950cc5/attachment.html>


More information about the Python-list mailing list