Re: how to call a function for evry 10 secs

2011-07-02 Thread Rune
Dennis Lee Bieber: Timer() is a one-shot; per the OPs requirements even it would need to be placed within a loop to invoke multiple calls -- so there isn't much gain in terms of lines of code... And worse, since it calls the function asynchronously and not sequentially, a delay time for

Re: how to call a function for evry 10 secs

2011-07-02 Thread anand jeyahar
Hi All, I need to call a function for evry 10 secs how can i achieve this in python import time while True: time.sleep(10) function() Please don't reinvent the wheel... Use the python apscheduler module. http://packages.python.org/APScheduler/#installing-apscheduler

Re: how to call a function for evry 10 secs

2011-07-01 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: I'll take this to the developers mailinglist and see if they consider the behaviour a bug. Filed as bug #12459. Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-07-01 Thread Rune Strand
from threading import Timer def Func_to_call: do_stuff() my_timer = Timer(10, Func_to_call) my_timer.start() -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-06-30 Thread Laurent Claessens
But if the function itself runs for longer than 10 seconds, there will be a major problem, as the sleep apparently takes the argument as unsigned, and a negative number is a very big sleep! Launch each call in a separate thread. If the calls are independent, this could be a solution.

Re: how to call a function for evry 10 secs

2011-06-30 Thread Ulrich Eckhardt
Dennis Lee Bieber wrote: But if the function itself runs for longer than 10 seconds, there will be a major problem, as the sleep apparently takes the argument as unsigned, and a negative number is a very big sleep! time.sleep() takes a floating point number, so an underflow like for

Re: how to call a function for evry 10 secs

2011-06-30 Thread MRAB
On 30/06/2011 17:42, Dennis Lee Bieber wrote: On Thu, 30 Jun 2011 10:37:34 +0200, Ulrich Eckhardt ulrich.eckha...@dominolaser.com declaimed the following in gmane.comp.python.general: time.sleep() takes a floating point number, so an underflow like for fixed-size integers in C shouldn't

Re: how to call a function for evry 10 secs

2011-06-30 Thread Chris Angelico
On Fri, Jul 1, 2011 at 3:18 AM, MRAB pyt...@mrabarnett.plus.com wrote: Looks like it hasn't changed even in WinXP, Python 3.2. Is IOError what you'd expect, anyway? What should it do in Python 3.2? Exception or max(seconds, 0)? The obvious thing for it to do is to go back in time and resume

Re: how to call a function for evry 10 secs

2011-06-30 Thread Ian Kelly
On Thu, Jun 30, 2011 at 11:18 AM, MRAB pyt...@mrabarnett.plus.com wrote:        And that was a direct cutpaste from a command window; showing it had slept for some 90 seconds before I killed it. Looks like it hasn't changed even in WinXP, Python 3.2. It gets cast to an unsigned long, so I

Re: how to call a function for evry 10 secs

2011-06-30 Thread Ulrich Eckhardt
Dennis Lee Bieber wrote: And that was a direct cutpaste from a command window; showing it had slept for some 90 seconds before I killed it. Interesting. Just tried a 2.7.2 on a 32-bit MS Windows with following results: 1. sleep(5 - 2**32) sleeps for a few seconds 2. sleep(-1) sleeps much

how to call a function for evry 10 secs

2011-06-29 Thread hisan
Hi All, I need to call a function for evry 10 secs how can i achieve this in python -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-06-29 Thread Steven D'Aprano
hisan wrote: Hi All, I need to call a function for evry 10 secs how can i achieve this in python import time while True: time.sleep(10) function() -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-06-29 Thread Max Countryman
(mailto:m...@me.com) wrote: How about this? import time def func(): #do stuff time.sleep(10) return func() On Wednesday, June 29, 2011 at 1:39 PM, hisan wrote: Hi All, I need to call a function for evry 10 secs how can i achieve this in python -- http