'how to fix "ValueError: Timezone offset does not match system offset: 0 != 3600. Please, check your config files"?

while trying to parse some dates using the dataparser lib in python it gets me this error.

import dateparser

dateparser.parse('12/12/12')

ValueError: Timezone offset does not match system offset: 0 != 3600. Please, check your config files.

I can't really grasp where is the problem here. I am using Atom as editor.

Thanks for your help.

enter image description here



Solution 1:[1]

I have a solution for this bug that might work for you but it's for Linux users.I could fix the bug using tzselect and .profile. Here are some instructions you can follow to fix this timezone bug:

  1. Run the tzselect command.
  2. Select your geographic area by number (eg. Africa: 1).
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa                                7) Europe
2) Americas                              8) Indian Ocean
3) Antarctica                                9) Pacific Ocean
4) Asia                                 10) coord - I want to use geographical coordinates.
5) Atlantic Ocean                           11) TZ - I want to specify the timezone using the Posix TZ format.
6) Australia
#? 1
  1. Select your country or a country whose clocks agree with yours (eg. Morocco: 34):
Please select a country whose clocks agree with yours.
 1) Algeria       12) Congo (Rep.)      23) Guinea            34) Morocco       45) South Sudan
 2) Angola        13) Côte d'Ivoire     24) Guinea-Bissau         35) Mozambique        46) Spain
 3) Benin         14) Djibouti          25) Kenya             36) Namibia       47) St Helena
 4) Botswana          15) Egypt         26) Lesotho           37) Niger         48) Sudan
 5) Burkina Faso      16) Equatorial Guinea     27) Liberia           38) Nigeria       49) Tanzania
 6) Burundi       17) Eritrea           28) Libya             39) Rwanda        50) Togo
 7) Cameroon          18) Eswatini (Swaziland)  29) Madagascar        40) Sao Tome & Principe   51) Tunisia
 8) Central African Rep.  19) Ethiopia          30) Malawi            41) Senegal       52) Uganda
 9) Chad          20) Gabon         31) Mali              42) Sierra Leone      53) Western Sahara
10) Comoros       21) Gambia            32) Mauritania        43) Somalia       54) Zambia
11) Congo (Dem. Rep.)     22) Ghana         33) Mayotte           44) South Africa      55) Zimbabwe
#? 34
  1. Select Yes if the given information is OK (eg. Yes: 1)
The following information has been given:

    Morocco

Therefore TZ='Africa/Casablanca' will be used.
Selected time is now:   Mon 18 Apr 2022 08:44:37 AM +00.
Universal Time is now:  Mon 18 Apr 2022 08:44:37 AM UTC.
Is the above information OK?
1) Yes
2) No
#? 1
  1. Make the change permanent and append it to .profile as follows:
You can make this change permanent for yourself by appending the line
    TZ='Africa/Casablanca'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Africa/Casablanca
  1. Go to the Home directory and run .profile to append your changes. Here is an example of how to append your changes to your .profile:
TZ='Africa/Casablanca'
export TZ
  1. Next, log out and log in again to confirm your changes.

Also, you can read this thread for more details about this bug.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rochdi Khalid