[Twisted-Python] Using StandardIO and pipes.

Maxim Lacrima lacrima.maxim at gmail.com
Wed Aug 15 04:28:37 EDT 2012


Hi Jean-Paul!

Thank you very much for explanation!

On 14 August 2012 13:40, <exarkun at twistedmatrix.com> wrote:

> On 07:51 am, lacrima.maxim at gmail.com wrote:
> >Hi Drew,
> >
> >I was referring to the example attached by Glyph. His example helped me
> >to
> >properly handle stdin in my code. In addition to stdin I want to handle
> >command line arguments, so I want to be able to do this:
> >$ echo foo | ./check.py
> >and this:
> >$ ./check.py foo
>
> Command line arguments aren't really anything like standard input.
> Command line arguments are available immediately, synchronously, in
> their entirety.  They are tokenized into a list of strings, and there
> are limits imposed on what bytes can appear in those strings.
>
> Standard input can only be read a little at a time, perhaps throughout
> the duration of the entire process, and attempting to do so may involve
> blocking or dealing with complicated, platform-specific non-blocking
> APIs.  Standard input can contain any bytes and arrives as a stream, not
> as a reliably tokenized list of strings.
>
> Twisted includes no support for treating stdin and command line
> arguments in a similar fashion.
>
> After you look up the command line arguments from sys.argv, just use the
> values.  There would seem to be little point in trying to shove them
> through a protocol object.
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
with regards,
Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120815/2172b596/attachment.htm 


More information about the Twisted-Python mailing list