prog1 | prog2 . How not to make prog2 block if not piped?

riquito at riquito at
Thu Jun 15 02:40:45 CEST 2006

Steve Holden ha scritto:

> When you run it "standalone" you should give it some input - type some
> text then enter ^D (on Unix-like systems) or ^Z (on Windows). How else
> do you expect read() to return anything? It *has* to read to the end fo
> the file before it returns a value.
> regards
>   Steve

you've got reason.
I must read my command line options, if then there is still text I use
that, otherwise I read from stdin. If nothing was piped, the user must
complete the work.

Thank you all,

More information about the Python-list mailing list