regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
184 stars 58 forks source link

ValueError: Timezone offset does not match system offset: -7200 != -10800. Please, check your config files. #78

Closed morpheus65535 closed 4 years ago

morpheus65535 commented 4 years ago

It seems there an issue again with tzlocal and daylight saving zone that have been canceled by Brazilian goverment and should have kick-in in the last days: https://time.is/time_zone_news/no_dst_in_brazil_in_2019

Here's the related issue: https://github.com/morpheus65535/bazarr/issues/641

regebro commented 4 years ago

This is likely because either your OS timezone data or your pytz release hasn't been updated.

morpheus65535 commented 4 years ago

Thanks for your feedback. I'll check with user and report back if both OS and pytz update doesn't fix the issue.

the-n3i commented 4 years ago

I'm having a very similar issue with a different cause: I traveled to a different timezone within Europe and switched my computer's setting in Gnome Settings (Settings->Date & Time -> Time Zone)

Now /etc/timezone lists my old timezone, while /etc/localtime points to the current timezone. Changing /etc/timezone every time I cross a border is not desirable, since I now have to update my time zone info in two places.

I'm using Manjaro Linux with Gnome 3.34.1 and tzlocal 2.0.0 installed via pip. Checking out the latest tzlocal from github showed the same behavior. Edit: pytz version: 2019.3

>cat /etc/timezone 
Europe/Berlin
>ls -alh /etc/localtime
lrwxrwxrwx 1 root root 37  3. Nov 15:59 /etc/localtime -> ../usr/share/zoneinfo/Europe/Helsinki
>
regebro commented 4 years ago

@the-n3i I'd say that's a bug in your Linux distro, if it creates a /etc/timezone but then doesn't update it when you switch the timezone.

The "Timezone offset does not match system offset" error causes a lot of questions here, but this is a good example of why it's useful. In this case, your /etc/timezone is actually incorrect, and tzlocal correctly catches that and fails.

regebro commented 4 years ago

I opened a generic issue #79 to discuss these sort of problems.