[Twisted-Python] Re: Debugging client programs

John Goerzen jgoerzen at complete.org
Wed Jul 30 17:42:51 EDT 2003

Itamar Shtull-Trauring <itamar at itamarst.org> writes:

>> Nothing shows how this is to be done with a client.
> Same way exactly.

I don't see how that can be the case.  All the examples I've seen
involve either listenTCP or a pre-built item that takes an

My client is of a different nature.  It needs to perform tasks at
startup such as evaluating which UI to use, reading its config file (I
know, this could be handled by TAP...), etc.  Then we establish
connections and start doing work.  I can't help but notice that none
of the simple client examples (ie, echoclient.py) aren't written to
use Application.

If it's that simple, if someone could just give me an example, I'd be
very appreciative.

I want to do things the right Twisted way.  But I don't want to make
that an inconvenience on the users.  It seems that the solutions
presented thus far for using twistd for a client will do that, so
that's why I wasn't before.  It's OK with me to not do that; I just
thought it was odd to be called "deluded" for not doing so.

That said, if there is a way to use twistd or its functionality and
avoid these pitfalls, I would be pleased to do that.

>> framework, but am not sure how to do it inside that framework.
> twistd --help should tell you (but, say "twistd --reactor=gtk -y
> yourfile.py").

See the other mail I just wrote (that's not quite good enough here).

>> Also, I have no objection to running twistd for my debugging, but my
>> excuse to not running twistd for end-users is that they should not
>> have to run "twistd /usr/bin/offlineimap" -- they should just run
>> offlineimap and invoke Python directly.
> You can have it work both ways, using an if __name__ == '__main__'.

Yup, that's fine with me and no problem to run twistd myself; I'd just
prefer to avoid making the end users do that.

> Again, I suggest you read my tutorial, the link to which was on the
> previous email (it's on my homepage.) If you want your program to parse
> command line arguments this won't work though.

Ahh, didn't realize that link was part of a larger thing.  I'll take a
closer look.  (And yes, command-line parsing is a requirement too)

Thanks for your help.

-- John

More information about the Twisted-Python mailing list