On 07:51 am, [email protected] 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
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to