-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detected blocking call to open with args ('/usr/local/lib/python3.13/site-packages/pytz/zoneinfo/Africa/Abidjan', 'rb') #687
Comments
The problem is likely in the pyscript code you are running. Are your scripts calling import_module directly or something similar? |
Please review this section of the docs. |
Thanks @craigbarratt for taking a look, I do not use import_module in my pyscript code and the traces in the logs seem to all coming from within pyscript, at least I can't identify any reference to my own code, but maybe I am missing something? |
Ah good point. I looked at this some more. pytz uses lazy loading (ie, defers loading specific timezone data files until needed). That's really problematic, since that means it will happen during use, not initialization. pyscript doesn't use pytz or timezones. Does your code use it? If so, you could use zoneinfo instead, which I believe is in the standard library for python >= 3.9. I'm not sure though if it uses lazy loading too... Another workaround is to call pytz with the right timezone in one of your scripts outside of any function, so that it is executed during load. Hopefully then it won't re-load the same timezone information later. |
fantastic, yes, I was using pytz. I changed it to zoneinfo and it does seem to do the trick! |
thanks again @craigbarratt, closing this as resolved. |
I am getting this warning which suggests to file a bug here. Running the latest HA Version 2025.1.3. Any advice what to do? Thanks!
The text was updated successfully, but these errors were encountered: