How to launch a function at regular time intervals ?

David davigier at googlemail.com
Thu Aug 13 18:25:58 CEST 2009


Thanks all for your answers. As suggested by Dave and Frank, I am
indeed looking for the main program to continue running in the
background (I have several functions I want to launch, each at a
predefined time interval). I like Frank's solution, on the paper it
seems it would do what I am looking for, but I cannot succeed in
having it working. I guess I've been stuck with this problem for too
long and can't succeed in using my brain accurately anymore... ;-)

I defined the class as defined by Frank, and I then inserted the
following code in a While True loop, without any other code (the idea
is just to test Frank's solution before really using it in my
program):

    func = MyFunction()
    func.start()

    func.stop()
    func.join()

However I'm not getting the expected behavior. It's not taking into
account the 30 sec wait, the function is called again and again
without any time interval... Any idea ?

Again, thanks a lot.




More information about the Python-list mailing list