Python 使用APScheduler版本3计划作业

Python 使用APScheduler版本3计划作业,python,apscheduler,Python,Apscheduler,我正在尝试使用APScheduler包在python中调度作业。这看起来很棒,但它的snytax已经过时了。对于当前的版本3,我转到了,但是我找不到一个基本示例,在这个示例中,我可以像链接的答案中那样将datetime对象传递给调度程序 from datetime import date from apscheduler.schedulers.background import BackgroundScheduler as Scheduler from datetime import datet

我正在尝试使用APScheduler包在python中调度作业。这看起来很棒,但它的snytax已经过时了。对于当前的版本3,我转到了,但是我找不到一个基本示例,在这个示例中,我可以像链接的答案中那样将
datetime
对象传递给调度程序

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!'])

这会产生错误:
找不到记录器“apscheduler.executors.default”的处理程序

上面的代码对我有效。。。看起来您得到的错误与日志记录模块有关。。。看到这个答案和问题了吗?还请注意,对于这样的脚本,主线程将在调度该作业后立即结束,从而终止进程。@AlexGrönholm那么,如果我在脚本末尾添加一个无限循环以使其保持打开状态,该作业将在指定的时间结束?还有什么选择?使用BlockingScheduler。这正是它的目的。