Re: tail -f sys.stdin

2005-06-09 Thread Andrew Dalke
garabik: > what about: > > for line in sys.stdin: > process(line) This does not meet the OP's requirement, which was >> I'd like to write a prog which reads one line at a time on its sys.stdin >> and immediately processes it. >> If there are'nt any new lines wait (block on input). It's a sub

Re: tail -f sys.stdin

2005-06-09 Thread garabik-news-2005-05
Antal Rutz <[EMAIL PROTECTED]> wrote: > Hi! > > Maybe a very newbie question but: > I'd like to write a prog which reads one line at a time on its sys.stdin > and immediately processes it. > If there are'nt any new lines wait (block on input). > what about: for line in sys.stdin: process(li

Re: tail -f sys.stdin

2005-06-09 Thread Antal Rutz
OK, it was really a newbie thing: import sys while True: line = sys.stdin.readline() process(line) sorry. -- --arutz -- http://mail.python.org/mailman/listinfo/python-list

Re: tail -f sys.stdin

2005-06-09 Thread Antal Rutz
Maybe I've found a poorman's one: import sys while True: try: line = sys.stdin.readline() except: sys.stdin.seek(0) else: process(line) Antal Rutz wrote: > Hi! > > Maybe a very newbie question but: > I'd like to write a prog which reads one line at a time on

tail -f sys.stdin

2005-06-09 Thread Antal Rutz
Hi! Maybe a very newbie question but: I'd like to write a prog which reads one line at a time on its sys.stdin and immediately processes it. If there are'nt any new lines wait (block on input). I couldn't find a solution for it. Several methods that doesn't fit here: - reading the entire file-lik