Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16489

Re: Reading twice from STDIN

From Gelonida N <gelonida@gmail.com>
Subject Re: Reading twice from STDIN
Date 2011-12-01 11:41 +0100
References <6de9515a-17b2-40a3-a113-5733cad9f794@cu3g2000vbb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3194.1322736307.27778.python-list@python.org> (permalink)

Show all headers | View raw


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.



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Reading twice from STDIN janedenone <janedenone@googlemail.com> - 2011-12-01 02:01 -0800
  Re: Reading twice from STDIN Gelonida N <gelonida@gmail.com> - 2011-12-01 11:41 +0100
  Re: Reading twice from STDIN Dan Stromberg <drsalists@gmail.com> - 2011-12-01 18:46 -0800
    Re: Reading twice from STDIN Hans Mulder <hansmu@xs4all.nl> - 2011-12-02 08:53 +0100
      Re: Reading twice from STDIN janedenone <janedenone@googlemail.com> - 2011-12-02 01:09 -0800
        Re: Reading twice from STDIN Hans Mulder <hansmu@xs4all.nl> - 2011-12-02 14:04 +0100
          Re: Reading twice from STDIN janedenone <janedenone@googlemail.com> - 2011-12-02 07:27 -0800

csiph-web