python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -
i have python app hosting on heroku. use apscheduler call function every day @ time. strange thing 1 time function runs after while have following error log:
exception in thread apscheduler (most raised during interpreter shutdown): 2017-09-06t15:03:28.347848+00:00 app[web.1]: traceback (most recent call last): 2017-09-06t15:03:28.347858+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/threading.py", line 810, in __bootstrap_inner 2017-09-06t15:03:28.347859+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/threading.py", line 763, in run 2017-09-06t15:03:28.347861+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/apscheduler/schedulers/blocking.py", line 27, in _main_loop 2017-09-06t15:03:28.348167+00:00 app[web.1]: <type 'exceptions.attributeerror'>: 'nonetype' object has no attribute 'now'
any guesses?
the full code long here key parts:
def startdayauto(): global daily_sum, weekly_sum, num daily_sum = 0 sheet.update_acell('f'+str(num-1), str(weekly_sum)) return sched = backgroundscheduler(timezone="europe/moscow") sched.add_job(startdayauto, 'cron', day_of_week='mon-sun', hour = 23, minute = 50) sched.start() port = int(os.environ.get('port', '5000')) updater.start_webhook(listen="0.0.0.0", port=port, url_path=config.token) updater.bot.set_webhook("https://secret-brushlands-84848.herokuapp.com/" + config.token) updater.idle()
Comments
Post a Comment