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
I think `main` function should look something like this:
def main():
if sys.stdin.isatty():
# we are connected to terminal
args = sys.argv[1:]
# ....
# What should I implement to be able to speak EchoItemProtocol???
# ....
else:
# we are connected to stdin
stdio.StandardIO(EchoItemProtocol())
reactor.run()
I am new to Twisted, so I don't know a proper term for a class I need to
implement (is it a factory, a transport, an endpoint etc.???) to be able to
speak EchoItemProtocol?
Is this a valid approach at all?
In case you can't find previously attached example, I have attached it
again.
On 14 August 2012 04:09, Drew Smathers <[email protected]> wrote:
> On Mon, Aug 13, 2012 at 8:18 AM, Maxim Lacrima <[email protected]>
> wrote:
> > Hi everyone!
> >
> > Thanks for the help! I used an attached example and after implementing
> > IHalfCloseableProtocol it works! Thanks a lot!
> >
>
> Hi Maxim,
>
> Sorry I do not have an immediate answer to your question but just
> wanted to let you that I don't see the file attachment mentioned
> above. You might have forgotten this.
>
> -Drew
>
> _______________________________________________
> Twisted-Python mailing list
> [email protected]
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
--
with regards,
Maxim
check.py
Description: Binary data
_______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
