Reading twice from STDIN

Gelonida N gelonida at gmail.com
Thu Dec 1 05:41:53 EST 2011


On 12/01/2011 11:01 AM, janedenone wrote:
Hi,


> 
> I would like to read from a pipe, parse the input and ask the user
> what to do next:
> 
> message = sys.stdin.read()

With above line you said, that you want to read ALL data from stdin, so
it's obvious that any following command will be unable to reda anything
from standartd in Thus the EOF error.


If you want to get input you had to read directly from the console (tty)
and NOT from stdin. Stdin has already been consumed.

It is possible in python to get the tty related to your console window
and read from it.
Unfortunately I don't kno whte commands by heart and I don't have time
now to look it up.

Perhaps somebody else can point you in the right direction.
If not I'll it up till tomorrow.







More information about the Python-list mailing list