Schedule Job with APScheduler Version 3

给你一囗甜甜゛ 提交于 2020-01-25 00:07:24

问题


I am trying to schedule a job in python using the APScheduler package. This answer looked great, but it's snytax is out of date. I went to user guide for the current version 3, but I cannot find a basic example where I can pass a datetime object to the scheduler like in the linked answer.

from datetime import date
from apscheduler.schedulers.background import BackgroundScheduler as Scheduler
from datetime import datetime

# Start the scheduler
sched = Scheduler()
sched.start()

# Define the function that is to be executed
def my_job(text):
    print text

#Schedule job
job = sched.add_job(my_job, next_run_time = datetime(2015, 5, 11, 1, 05, 5), args = ['Hello World!'])

This yields the error: No handlers could be found for logger "apscheduler.executors.default".

来源:https://stackoverflow.com/questions/30280203/schedule-job-with-apscheduler-version-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!