sched() function questions

Chris Hare chare at labr.net
Fri Aug 6 23:37:26 EDT 2010


I am currently using threading.timer to execute an event in my big chunk of code.  This is causing a problem with sqlite, so I am trying to figure out the sched function

import sched
import time

def timerfunc():
    print "hello", time.time()
    return(time.time())

def delay(period):
    time.sleep(period)

def some():
    s.enterabs(900,1, timerfunc, () )
    s.run()

s = sched.scheduler(timerfunc, delay)

print time.time()
some()
x = 0
while 1:
    print x
    x = x + 1
    time.sleep(60)
    print str(s.queue())

What I am trying to do is mimic the Timer function, where my code will continue to function while my scheduled function executes in 15 minutes or 900 seconds.  This doesn't do it though.  Any help?




More information about the Python-list mailing list