Re: do "some action" once a minute

2006-05-09 Thread James Stroud
Petr Jakes wrote: > I would like to do "some action" once a minute. My code (below) works, > I just wonder if there is some more pythonic approach or some "trick" > how to do it differently. > > minutes=time.localtime()[4] > while 1: > min, sec = t

Re: do "some action" once a minute

2006-05-09 Thread Larry Bates
Petr Jakes wrote: > I would like to do "some action" once a minute. My code (below) works, > I just wonder if there is some more pythonic approach or some "trick" > how to do it differently. > > minutes=time.localtime()[4] > while 1: > min, sec = t

Re: do "some action" once a minute

2006-05-09 Thread Ben C
On 2006-05-09, Petr Jakes <[EMAIL PROTECTED]> wrote: > I would like to do "some action" once a minute. You can try the sched module (import sched). You give it a time at which to call a callback. Then in the callback you can reset the "alarm" for a minute later,

Re: do "some action" once a minute

2006-05-09 Thread [EMAIL PROTECTED]
This is why your best bet is probably threads. Class Eureka(Threading.Thread): def __init__(self): Threading.Thread.__init__(self) self.start() def run(self,sleep_time): while 1: time.sleep(sleep_time) print "eureka" -- http://mail.python.o

Re: do "some action" once a minute

2006-05-09 Thread Irmen de Jong
Petr Jakes wrote: > OK, to be more specific, I would like to run the code, when the value > of seconds in the timestamp become say "00". > The whole code will run in the infinitive loop and other actions will > be executed as well, so it can not "sleep" for 60 seconds :). Have a look at my 'Kronos

Re: do "some action" once a minute

2006-05-09 Thread Diez B. Roggisch
Petr Jakes wrote: > Thanks for your comment. It is mainly English issue (I am not native > English speaker). > > OK, to be more specific, I would like to run the code, when the value > of seconds in the timestamp become say "00". > The whole code will run in the infinitive loop and other actions

Re: do "some action" once a minute

2006-05-09 Thread Petr Jakes
Thanks for your comment. It is mainly English issue (I am not native English speaker). OK, to be more specific, I would like to run the code, when the value of seconds in the timestamp become say "00". The whole code will run in the infinitive loop and other actions will be executed as well, so it

Re: do "some action" once a minute

2006-05-09 Thread Sybren Stuvel
Petr Jakes enlightened us with: > I would like to do "some action" once a minute. My code (below) > works, I just wonder if there is some more pythonic approach or some > "trick" how to do it differently. I'd use the Threading module, and the Timer object f

do "some action" once a minute

2006-05-08 Thread Petr Jakes
I would like to do "some action" once a minute. My code (below) works, I just wonder if there is some more pythonic approach or some "trick" how to do it differently. minutes=time.localtime()[4] while 1: min, sec = time.localtime()[4:6] if sec==0 and minutes!=min: # f