初学者啦啦啦 发表于 2020-10-28 17:21:31

scheduler 错误 Can not find timezone

from datetime import datetime
from datetime import date
from apscheduler.schedulers.blocking import BlockingScheduler

def job(text):
    print(text)

scheduler = BlockingScheduler()
# 在 2019-8-30 运行一次 job 方法
scheduler.add_job(job, 'date', run_date=date(2019, 8, 30), args=['text1'])
# 在 2019-8-30 01:00:00 运行一次 job 方法
scheduler.add_job(job, 'date', run_date=datetime(2019, 8, 30, 1, 0, 0), args=['text2'])
# 在 2019-8-30 01:00:01 运行一次 job 方法
scheduler.add_job(job, 'date', run_date='2019-8-30 01:00:00', args=['text3'])

scheduler.start()

---------------------------------------------------------------

D:\python3.8\python.exe C:/Users/000/Desktop/python/jd/.idea/a.py
Traceback (most recent call last):
File "C:/Users/000/Desktop/python/jd/.idea/a.py", line 8, in <module>
    scheduler = BlockingScheduler()
File "D:\python3.8\lib\site-packages\apscheduler\schedulers\base.py", line 87, in __init__
    self.configure(gconfig, **options)
File "D:\python3.8\lib\site-packages\apscheduler\schedulers\base.py", line 126, in configure
    self._configure(config)
File "D:\python3.8\lib\site-packages\apscheduler\schedulers\base.py", line 697, in _configure
    self.timezone = astimezone(config.pop('timezone', None)) or get_localzone()
File "D:\python3.8\lib\site-packages\tzlocal\win32.py", line 93, in get_localzone
    _cache_tz = pytz.timezone(get_localzone_name())
File "D:\python3.8\lib\site-packages\tzlocal\win32.py", line 84, in get_localzone_name
    raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)
pytz.exceptions.UnknownTimeZoneError: 'Can not find timezone '

初学者啦啦啦 发表于 2020-10-28 17:22:09

大佬们怎么解决啊
就算代码照搬网上的也是这个问题
页: [1]
查看完整版本: scheduler 错误 Can not find timezone