[Twisted-Python] Using StandardIO and pipes.
lacrima.maxim at gmail.com
Wed Aug 15 04:28:37 EDT 2012
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
> >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.
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python