Trigger a Python function exactly on the minute
Question: I have a function that I want to trigger at every turn of the minute — at 00
seconds. It fires off a packet over the air to a dumb display that will be
mounted on the wall.

I know I can brute force it with a while loop but that seems a bit harsh.

I have tried using sched but that ends up adding a second every minute.

What are my options?


Answer: You might try
[APScheduler](http://pythonhosted.org/APScheduler/cronschedule.html), a cron-
style scheduler module for Python.

From their examples:

    
    
    from apscheduler.scheduler import Scheduler
    
    # Start the scheduler
    sched = Scheduler()
    sched.start()
    
    def job_function():
        print "Hello World"
    
    sched.add_cron_job(job_function, second=0)
    

will run `job_function` every minute.

