[Twisted-Python] Re: reactor.stop stops entire twistd
Tsai Li Ming
mailinglist at ltsai.com
Wed Jul 28 05:29:24 EDT 2004
We have the following class that is instantiated within the sever code
that is using twistd to issue system calls.
result = None
status = None
cmd = ''
def __init__(self, cmd, args=):
self.cmd = cmd
self.args = args
def ok(self, result):
self.result = result
self.status = 0
def err(self, err):
self.result = err.getErrorMessage()
self.status = 1
d = utils.getProcessOutput(self.cmd, self.args, os.environ)
if self.status == None: self.status = 0
if self.result[-1:] == '\n': self.result = self.result[:-1]
return self.status, self.result
Since the reactor is already running, how do I actually use Deferred?
Christopher Armstrong wrote:
> On Wed, 28 Jul 2004 17:07:36 +0800, Tsai Li Ming <mailinglist at ltsai.com> wrote:
>>Ok. then how do I aviod using reactor.start() and reactor.stop() for
> Well, since you're using twistd, the reactor is already running, so
> you don't need to call reactor.run(). And you shouldn't be calling
> reactor.stop(), because you said you didn't want to stop the reactor.
> So, just don't call them. But the fact that I need to say something so
> obvious makes me think I'm not grasping the whole picture. If my
> explanation so far is insufficient, can you show more code?
More information about the Twisted-Python