How to launch a function at regular time intervals ?

Dave Angel davea at ieee.org
Thu Aug 13 21:28:02 CEST 2009


David wrote:
> 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.
>
>
>   
Why don't you include the code you're actually trying, instead of just 
trying to describe it.  Frank's class didn't call any function, it just 
had a place to do it.  So we really don't know what you're running, nor 
what about it is wrong.

Perhaps a few well placed print statements?

DaveA



More information about the Python-list mailing list