Le Mercredi 14 Juin 2006 17:13, [EMAIL PROTECTED] a écrit :
> # script1.py #
> print 'something'
>
> #script2.py
> x=sys.stdin.read()
read() will read a file object to the end, i guess you want to use readline()
instead or the builtin raw_input.
> print 'passed'
>
> if I run
> script1.py | script2.py
> all goes well.
This is because when script1.py ends, it will send an 'EOF' char to
script2.py, wich terminate the read method.
>
> But if I run just
> script2.py
> the program blocks waiting forever for input.
here, newlines ('\n'), doesn't terminate the read call, you can stop the read
by typing ctrl+d at the beginnning of a new line in a normal unix terminal.
--
_____________
Maric Michaud
_____________
Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
--
http://mail.python.org/mailman/listinfo/python-list