Shutting down twisted reacotr

Operation Latte Thunder chris at angband.org
Wed Apr 27 15:52:19 EDT 2005


I have a simple ( I hope ) problem that I have been baning my head against
all day.  I have isolated it down to a very small demo script, which I
will include below.

Basically, I want to have twisted run until an event makes it stop. My
problem is that my reactor.stop() doesn't seem to do anything if its not
called via a calllater or an equivilent.  Unfortunately, my google-fu
seems weak today, as I have not been able to discern its solution.
Without further adieu:

from thread import start_new_thread
import time
from twisted.internet import reactor

def shutdown():
        time.sleep( 1 )
        print "Stopping"
        reactor.stop()

start_new_thread ( shutdown, () )

reactor.run()
print "done"

This will continue to run even after printing "Stopping"

any ideas?

-- 
chris at acheris.net			|             Roma Invicta!



More information about the Python-list mailing list