david.craig.wilson at gmail.com
Fri Sep 19 22:28:27 MDT 2008
I'm trying to pick up Twisted and I'm having trouble with looping.
I expected that a Deferred returned from a looping call would be available
after each call. But it's only available after the loop is stopped. Am I
looking for a different class?
p.s. Ultimately I'd like to watch a file and post any new lines up to an
HTTP server. If there is a direct way to get there, please let me know.
from twisted.internet import task, defer
from twisted.internet import reactor
list = 
for line in fp.readlines():
str_list = str(list)
d = defer.Deferred()
print 'calling string list...'
sys.stdout.write('string: ' + string)
fn = r"C:\var\twisted.txt"
f = open(fn, 'r')
#l = task.LoopingCall(runEverySecond)
l = task.LoopingCall(check_file_p, f)
d = l.start(5.0, False) # call every x seconds
d = task.deferLater(reactor, 3.5, check_file_p, f)
print 'starting reactor'
#l.stop() #will stop the looping calls
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python