[Twisted-Python] Some problems with twisted

Moshe Zadka twisted at zadka.site.co.il
Tue Dec 2 05:01:41 EST 2003

On Tue, 2 Dec 2003, Pieter Claerhout <Pieter.Claerhout at Creo.com> wrote:

> 2. During the execution of the doProcessing function, it's impossible to
> stop the application with e.g. CTRL+BREAK. Is there a way around this?

That's the first sign of problems: "during" a function call is a perceptable

Here's code which would do the right thing, completely untested.
Notice how calculate, which would do the MySQL dance [probably
a bad idea to use SQL for these things], is only called when
the data is ready.

from twisted.application import service, internet
from twisted.web import server, static, client

def ProcessingService():
    return internet.TimerService(_doProcessing,

def _doProcessing(urls):
    def calculation(data):
        pass # do something here
    for url in urls:

def WebAdminService():
    return internet.TCPService(9119, server.Site(static.File('htdocs')))

application = service.Application('myapp')
for s in [ProcessingService(), WebAdminService()]:

More information about the Twisted-Python mailing list