日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

【Apscheduler】不生效也不报错,提示No handlers could be found for logger “apscheduler.executors.default”

發布時間:2024/2/28 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Apscheduler】不生效也不报错,提示No handlers could be found for logger “apscheduler.executors.default” 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

寫代碼最怕的是,語句既不生效,也不報錯。。

Apscheduler中添加如下代碼

from apscheduler.schedulers.blocking import BlockingSchedulerimport logging logging.basicConfig()

作用:Call logging.basicConfig() before instantiating the scheduler. That lets you see what the real problem is.
就可以正常看到報錯信息了


不完整示例

#!/usr/bin/env python # encoding:utf-8 import datetime import sysfrom apscheduler.schedulers.blocking import BlockingScheduler from app.job.core import test_print from apscheduler.schedulers.blocking import BlockingSchedulerimport logginglogging.basicConfig() sched = BlockingScheduler()def my_job(text):print(text)def job_function():print("This is job_function")test_print()sys.stdout.flush()# 在2014-05-30 00:00:00前,每周一到每周五 5:30運行 # sched.add_job(job_function, 'cron', day_of_week='mon-fri', hour=21, minute=22, end_date='2022-01-01') sched.add_job(job_function, 'interval', seconds=2)sched.start()

總結

以上是生活随笔為你收集整理的【Apscheduler】不生效也不报错,提示No handlers could be found for logger “apscheduler.executors.default”的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。