Apschedulerで出るValueError: Unable to determine the name of the local timezon
発生エラー
久々にApchedulerを使うとこんなエラーに出くわしました。
忘れそうなのでメモしておきます。
ValueError: Unable to determine the name of the local timezone -- you must explicitly specify the name of the local timezone. Please refrain from using timezones like EST to prevent problems with daylight saving time. Instead, use a locale based timezone name (such as Europe/Helsinki).
ValueError: Unable to determine the name of the local timezone
タイムゾーンを設定しろと。
解決策
日本時間にしたいんですが、その設定ってどうやって書くんだろう...
例えば、Europe/Helsinki、みたいな感じに書けばいいっぽいので、Asia/Tokyoかな??
ビンゴでした。エラーは解決。
from apscheduler.schedulers.blocking import BlockingScheduler import donchan sched = BlockingScheduler(timezone="Asia/Tokyo") @sched.scheduled_job('interval', minutes=1) def scheduled_job(): bot = donchan.botter() bot.whileman() sched.start()