Reading twice from STDIN

2011-12-01 Thread janedenone
Hi, I would like to read from a pipe, parse the input and ask the user what to do next: message = sys.stdin.read() # message is parsed and URLs are printed as a list to choose from... selected_index = raw_input('Which URL to open?') Calling raw_input() always raises in an EOFError. I tried reope

Re: Reading twice from STDIN

2011-12-02 Thread janedenone
On Dec 2, 8:53 am, Hans Mulder wrote: > On 2/12/11 03:46:10, Dan Stromberg wrote: > > > You can read piped data from sys.stdin normally.  Then if you want > > something from the user, at least on most *ix's, you would open > > /dev/tty and get user input from there.  'Not sure about OS/X. > > Read

Re: Reading twice from STDIN

2011-12-02 Thread janedenone
On Dec 2, 2:04 pm, Hans Mulder wrote: > That's odd.  For some reason, I can get away with a simple > >      sys.stdin = open('/dev/tty') > > and raw_input will merrily read from file descriptor 3. > > I'm using Pyhton 2.7.1 and 3.2 on MacOS/X 10.5.0. > > What version are you using? > > -- HansM