from apscheduler.scheduler import Scheduler
import os
class ListHref():
def __init__(self):
print 'In ListHref Class!'
self.name_hrefs = {}
self.name_img = {}
self.path = os.path.dirname(__file__)
print 'Out ListHref Class'
def other_function():...
def job(): #function named job
print 'In job!'
book_href = ListHref()
print 'book_href created!'
if __name__ == "__main__":
sched = Scheduler()
#job() #it's ok if job() called only
sched.daemonic = False #non daemon thread
sched.add_interval_job(job,minutes=0.1)
sched.start()
Problem: If call job() only instead of sched,it's ok So I am confused that why the init(self) cannot called completely? and what's wrong with 'No handerls could be found for logger "apscheduler.scheduler"'? Above python code result:
In job()
In ListHref Class!
No handerls could be found for logger "apscheduler.scheduler"
In job()
In ListHref Class!
In job()
In ListHref Class!
...(so on)
apscheduler is using the python logging module which needs to be initialized. Logging is a bit complicated (see the link) but the minimum is to:
import logging
logging.basicConfig()
basicConfig supports some common logging features but its worth figuring out some of the more sophisticated uses for the logger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With