En Fri, 24 Apr 2009 11:54:40 -0300, grocery_stocker <cdal...@gmail.com> escribió:

scheduler = sched.scheduler(time.time, time.sleep)

How do I modify it so that it runs every hour on the hour.

(The sched module is almost useless, IMHO)

I'd use cron (linux) or schtasks (windows).
If it has to be a Python script, I'd just use time.sleep:

def compute_delay_until_next_hour():
  now = time.localtime()
  secs_past_hour = now.tm_min * 60 + now.tm_sec
  delay = 60*60 - secs_past_hour
  return delay

# do_something() # optional
while True:
  dt = compute_delay_until_next_hour()
  time.sleep(dt)
  do_something()

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to