I am trying to run a python async app with an asyncioscheduler scheduled job but the APScheduler fails during build because of this error:
'Only timezones from the pytz library are supported' error
I do include pytz in my app and i am passing the timezone. What is causing the error?
I am calling the asyncioscheduler in a class where i create job manager:
from apscheduler.schedulers.asyncio import AsyncIOScheduler
class ScheduleManager:
def __init__(self) -> None:
self.scheduler = AsyncIOScheduler()
def start(self):
self.scheduler.start()
def stop(self):
self.scheduler.shutdown()
def add_seconds_interval_job(self, callback, interval : int):
self.scheduler.add_job(callback, 'interval', seconds = interval)
def add_minutes_interval_job(self, callback, interval : int):
self.scheduler.add_job(callback, 'interval', minutes = interval)
def add_hours_interval_job(self, callback, interval : int):
self.scheduler.add_job(callback, 'interval', hours = interval)
def add_days_interval_job(self, callback, interval : int):
self.scheduler.add_job(callback, 'interval', days = interval)
then i call this manager from my application like :
from jobs import ScheduleManager, ConfigJob
class AppInitializer:
def __init__(self) -> None:
self.schedule_manager = ScheduleManager()
self.config__job = ConfigJob()
async def initialize(self, app, loop):
self.schedule_manager.add_seconds_interval_job(self.config_job.run, 5)
self.schedule_manager.start()