Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps¶
If you schedule a job using
schedulein IPython shell, and then interrupt the following loop that checks and runs pending jobs,while True: schedule.run_pending()the scheduled job is still there unless you stop the current IPython shell. The effective consequence of this is that if you schedule another job , and start to run it using the following loop,
while True: schedule.run_pending()the job will also continue to run! This might not what you expect since when you intterup the loop that checks and runs pending jobs, you might thought that you killed scheduled jobs, which is not correct.
Installation¶
pip3 install scheduleExample¶
import schedule
import time
def job():
print("I'm working...")
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)
schedule.every().minute.at(":17").do(job)
while True:
schedule.run_pending()
time.sleep(1)schedule.job.do¶
Specifies the job_func that should be called every time the job runs. Any additional arguments are passed on to job_func when the job runs.