Hi Jean-Paul!<div><br></div><div>Thank you very much for explanation!<br><br><div class="gmail_quote">On 14 August 2012 13:40, <span dir="ltr"><<a href="mailto:exarkun@twistedmatrix.com" target="_blank">exarkun@twistedmatrix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 07:51 am, <a href="mailto:lacrima.maxim@gmail.com">lacrima.maxim@gmail.com</a> wrote:<br>
>Hi Drew,<br>
><br>
>I was referring to the example attached by Glyph. His example helped me<br>
>to<br>
>properly handle stdin in my code. In addition to stdin I want to handle<br>
>command line arguments, so I want to be able to do this:<br>
>$ echo foo | ./check.py<br>
>and this:<br>
>$ ./check.py foo<br>
<br>
</div>Command line arguments aren't really anything like standard input.<br>
Command line arguments are available immediately, synchronously, in<br>
their entirety. They are tokenized into a list of strings, and there<br>
are limits imposed on what bytes can appear in those strings.<br>
<br>
Standard input can only be read a little at a time, perhaps throughout<br>
the duration of the entire process, and attempting to do so may involve<br>
blocking or dealing with complicated, platform-specific non-blocking<br>
APIs. Standard input can contain any bytes and arrives as a stream, not<br>
as a reliably tokenized list of strings.<br>
<br>
Twisted includes no support for treating stdin and command line<br>
arguments in a similar fashion.<br>
<br>
After you look up the command line arguments from sys.argv, just use the<br>
values. There would seem to be little point in trying to shove them<br>
through a protocol object.<br>
<br>
Jean-Paul<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>with regards,<br>Maxim<br>
</div>