[Twisted-Python] Learning Twisted

Jason Diamond jason at injektilo.org
Sun May 16 21:57:26 EDT 2004

Glyph Lefkowitz wrote:

> If possible, you should try to run Twisted code under twistd, which 
> means that you'd remove that code from your Python module, and put it 
> into a separate .tac file that read something like:
> from twisted.application.internet import TCPClient
> from twisted.application.service import Application, IServiceCollection
> application = Application("my client application")
> f = MyIMAP4ClientFactory()
> client = TCPClient("server", 143, f)
> client.setServiceParent(application)
> Even if you do have a need to put your code into its own script - and 
> the twistd support for clients is admittedly weaker than that for 
> servers - it's generally a good idea not to put it in the same script 
> as  your code.

Thanks for the tip, I started reading the "Twisted from Scratch" 
tutorial [1] and see why this is useful now. For my simple client 
explorations, though, it's spitting out a lot more output than I would 
expect. But still very informative!

-- Jason


More information about the Twisted-Python mailing list