I have a python script that runs through night work on Heroku. From time to time (and lately, much more), the script is not executed due to the error below.
2015-02-25T05:00:02.671242+00:00 app[clock.1]: No handlers could be found for logger "apscheduler.executors.default"
The script is executed using the built-in clock method, as defined in my Procfile.
clock.py:
import sys
import logging
sys.path.append('main')
from main import main
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()
@sched.scheduled_job('cron', hour=5)
def scheduled_job():
logging.basicConfig()
main()
sched.start()
I searched the Internet and based on several answers that I read, people say that this is a warning, not a mistake. However, this problem causes the entire script to crash when this happens. My question is first, is there a fix? And secondly, why does this happen sometimes, and not always ?
Many people said just add the following to the script:
import logging
logging.basicConfig()
, , , .