-
Notifications
You must be signed in to change notification settings - Fork 58
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
get_localzone returns 'local' on alpine linux docker container (Python:alpine) #44
Comments
This means none of the ways to figure out the time zone name worked. There may not be one on Alpine Linux, or it's sufficiently non-standard to not already be included. Including a way would be possible if there is a reliable way to deduce the name in standard setups. |
Heres a way to determine the name. cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.4.6
PRETTY_NAME="Alpine Linux v3.4"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org" |
No, I mean the name of the time zone. For example, Ubuntu writes it to /etc/timezone |
You put me on the right path it appears that the Alpine docker container doesn't have TZ data in there. Following https://wiki.alpinelinux.org/wiki/Setting_the_timezone, makes it produce the proper TZ info when you call tzlocal.get_localzone() |
Super! |
This is reported to be a problem too in Windows' Ubuntu Bash thing: learningequality/kolibri#2484 |
Your system isn't configured in such a way that it's possible to figure out the timezone name. The timezone object returned is therefore using the name "local" for the time zone. This is not a bug, but a feature. If you want a time zone name, configure your system properly. |
It's not my system, I'm reporting this on behalf of others having problems. The way I solved it wasn't to do much but raise |
Yeah, if you need a timezone name, and tzlocal doesn't give that, that's a reasonable way to handle it. |
When i run
tzlocal.get_localzone()
it returns<StaticTzInfo 'local'>
Steps to recreate
docker run --rm -it python:alpine /bin/sh
pip install tzlocal
python
output of /etc/localtime
/usr/local/etc/localtime
does not exist.The text was updated successfully, but these errors were encountered: