How to launch a function at regular time intervals ?
python at mrabarnett.plus.com
Thu Aug 13 19:16:21 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
> func = MyFunction()
> 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.
What exactly do you mean by "I then inserted the following code in a
While True loop"? Do you mean you put all four lines in it? If yes,
then you're repeatedly starting then stopping the function.
More information about the Python-list