Hi Terry,

On Fri, 13 Feb 2026 10:50:16 +0000, Terry Coles wrote:
> /home/pi/.local/lib/site-packages/apscheduler/triggers/interval.py:6
> 6: PytzUsageWarning: The normalise method is no longer necessary, as
> this time zone supports the fold attribute (PEP495).  For more
> details on migrating to a PEP 495-compliant implementation see
> https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.htm
> l.

The apscheduler package is using the tzlocal package as one of its 
dependencies.

This warning message arises when apscheduler's IntervalTrigger class 
calls the normalize method of a tzlocal timezone object, which you can 
see in the apscheduler v3.8.1 source code here:

https://github.com/agronholm/apscheduler/blob/fc5c361dd9978c593b82125028119a358790048d/apscheduler/triggers/interval.py#L66

So, the warning in this case is directed at the developer of 
apscheduler. It doesn't relate to the code you have written. 
Modifying your code probably won't stop the warning appearing.

It's not saying anything is going wrong. It's just rather forcefully 
saying there's now a new way to achieve the same outcome. I suppose 
the implication is that, if the new way of doing it doesn't get 
adopted, then eventually the old way of doing it might stop working, 
but that would be in some future release, not this one.

It's been discussed on the apscheduler issue tracker:
https://github.com/agronholm/apscheduler/discussions/570

According to the discussion, the warnings can be safely ignored, or 
tzlocal can be downgraded to a 2.x version to make them go away.

Apparently apscheduler 4.x (which appears to be in alpha; not 
released yet) fixes this properly. Looking at the source code and the 
discussions, a quick fix to stop the warnings appearing has been 
implemented as of apscheduler v3.9.0, but the continued discussion 
indicates that this did not catch all possible triggers for the 
warning and they're not going to completely fix it in 3.x.

So, it sounds like upgrading apscheduler is, in fact, a solution. 
It's just that the version you need to upgrade it to hasn't been 
released yet!


Patrick Wigmore



-- 
  Next meeting: Online, Jitsi, Tuesday, 2026-03-03 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
  New thread, don't hijack:  mailto:[email protected]

Reply via email to