以下実行時に表題のwarningがでた時の解決策(回避策)
apschedulerについては以下
Advanced Python Scheduler
Advanced Python Scheduler (APScheduler) is a Python library that lets you schedule your Python code to be executed later, either just once or periodically.
warning
は以下
`The zone attribute is specific to pytz's interface; please migrate to a new time zone provider`
以下の実装部分がwarning出している様子
https://github.com/agronholm/apscheduler/blob/v3.8.1/apscheduler/util.py#L95
if obj.zone == 'local':
原因は以下のようにapscheduler内で使っているzoneinfoがdeprecatedであるためである様子
PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider
The problem is pytz is considered deprecated in favor of zoneinfo module and its backports. So even if you set directly timezone argument as suggested before, you'll probably face the same warning from some other places until apsheduler would fix pytz usage for modern Python version.
以下の通りtzlocalのバージョンが起因しているようなので、tzlocalのバージョンを更新すると解決した。
https://github.com/agronholm/apscheduler/discussions/570
This happens with tzlocal 4.0. You can either (safely) ignore those warnings or downgrade tzlocal to 2.x. The problem is "properly" fixed on master but likely won't be in the 3.x branch.
pip3 install tzlocal==2.1
ただし、記載の注意点の通り、他の依存関係に影響あるかもしれないので注意
But, please, pay attention it could break other project dependencies, so be careful.
#参考
PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider
Advanced Python Scheduler
https://github.com/agronholm/apscheduler/discussions/570
PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. #187