On 23/01/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > I can get the script to behave as expected when content's piped to it > > using sys.stdin but I'd like to know that there's data coming from > > stdin or fail and print the useage again. Is there a simple way to > > achieve this? > > There are more experienced UNIXers here, but from my POV I don't see how > that can happen. The reason is simply that > > - sys.stdin alwasy exists (unless you close it yourself) > > - in a pipe (which this essentially is) there is now way to know if there > is more date to come or not, except for the "broken pipe" error - but that > won't happen to you, as sys.stdin is not broken just because there is > currently no data arriving.
That's a good point. I did wonder if it'd just have to sit there waiting for input much like cat would. I think that's preferable, and simpler :), than implementing timeouts. Thanks. Will. -- http://mail.python.org/mailman/listinfo/python-list