By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,942 Members | 1,788 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,942 IT Pros & Developers. It's quick & easy.

how to Running a particular funtion at a regular interval of time

P: 21
I'm executing two function in a program in a infinite loop.

In that loop i want run a particular a particular function which is out side the function, but that function also runs simultaneously with that function.

when i tried with the threading.Timer(), the function that is to be executed, it throws an exception as cannot start another thread of that function. As that function is already running in the loop.

Can u provide me the solution ASAP.

Thanks in advance......
Mar 13 '09 #1
Share this Question
Share on Google+
6 Replies

Expert Mod 2.5K+
P: 2,851
I don't know if I can help you, but you would be more likely to receive help if you posted your code.

-BV, Moderator
Mar 13 '09 #2

P: 21
I found a way to run it....
anyway thanks...........
Mar 14 '09 #3

Expert Mod 2.5K+
P: 2,851
Would you care to share your solution with us in case someone else has this problem?
Mar 14 '09 #4

P: 21
yaa sure....
Expand|Select|Wrap|Line Numbers
  1. import time 
  2. the_time = time.time()
  3. Timer_Counter = 30
  5. def sample(request)
  6.     global the_time
  7.     elapsed_time = time.time() - the _time
  8.     if elapsed_time < 0
  9.          do.....something or call a function
  10.          the_time() = time.time()

Here the Sample function runs in infinite loop.
after every 30 seconds the some other code also executes....
Mar 14 '09 #5

Expert Mod 2.5K+
P: 2,851
Thank you for sharing. I added code tags around your code. That makes it easier to read and the indentation is preserved.

Mar 14 '09 #6

P: 21
thank you very much........................
Mar 14 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.