Timezone offset does not match system offset
Hi!
I'm not sure if this is a problem here or in taskpirate, but since you are the developer of both, I don't think it matters much. ;)
I created a task like this:
task add prio:B Do stuff rRec:3w rWait:2w due:2021-03-06 +tester
(rRec and rWait are renamed values from line 16 and 17 of relative-recur)
(And yes, it's deliberately in the past.)
When I now do the task, I get this:
task do 15
Completed task 96d3a787 'Do stuff'.
Completed 1 task.
Created follow-up task
The project 'INBOX' has changed. Project 'INBOX' is 25% complete (3 of 4 tasks remaining).
jcp@kappa:~$ Traceback (most recent call last):
File "/home/jcp/.task/hooks/on-add-pirate", line 9, in <module>
from tasklib import TaskWarrior, Task
File "/home/jcp/.local/lib/python3.8/site-packages/tasklib/__init__.py", line 1, in <module>
from .backends import TaskWarrior
File "/home/jcp/.local/lib/python3.8/site-packages/tasklib/backends.py", line 11, in <module>
from .task import Task, TaskQuerySet, ReadOnlyDictView
File "/home/jcp/.local/lib/python3.8/site-packages/tasklib/task.py", line 9, in <module>
from .serializing import SerializingObject
File "/home/jcp/.local/lib/python3.8/site-packages/tasklib/serializing.py", line 11, in <module>
local_zone = tzlocal.get_localzone()
File "/home/jcp/.local/lib/python3.8/site-packages/tzlocal/unix.py", line 165, in get_localzone
_cache_tz = _get_localzone()
File "/home/jcp/.local/lib/python3.8/site-packages/tzlocal/unix.py", line 90, in _get_localzone
utils.assert_tz_offset(tz)
File "/home/jcp/.local/lib/python3.8/site-packages/tzlocal/utils.py", line 46, in assert_tz_offset
raise ValueError(msg)
ValueError: Timezone offset does not match system offset: 3600 != 0. Please, check your config files.
Hook Error: Expected feedback from a failing hook script.
The task is actually not recreated, though.
Thank you very much in advance for taking a look.
Have a nice weekend,
Hi @proedie,
this problems is described in the following issue on the tzlocal repo (which is one of the tasklib's dependencies): https://github.com/regebro/tzlocal/issues/79
It looks like it occurs on system where there is some setup problem with the timezone. One of the posters recomments re-configuring timezone settings on your machine using the tzselect command.
Hope this helps!
Okay, this is a weird one. I just spend some time debugging this with the aid of the python console, going through the code of the files from the error messages (from bottom up). I'm not a python programmer so I actually had no idea what I was doing. It was still fun, though.
Anyway, I found something in the unix.py script from the line: File "/home/jcp/.local/lib/python3.8/site-packages/tzlocal/unix.py", line 90, in _get_localzone utils.assert_tz_offset(tz)
This line should never have been called in the first place! Earlier, on line 52 (on my version of the file) it says:
tzenv = _try_tz_from_env()
if tzenv:
return tzenv
When I go through the code of _try_tz_from_env() in the console, I do get my ‘time zone environment’ (that's what tzenv stands for). And indeed, when I change the code above to this it just works:
tzenv = _try_tz_from_env()
return tzenv
if tzenv:
return tzenv
I don't know why the if is broken, but -- and here comes the weird part -- it's only broken when it's called from shift-recurrence!
If we change our return tzenv (ie the one before the if) to print("🚩 " + str(tzenv)) we get this:
jcp@kappa:~$ task add prio:B Do stuff rRec:3w rWait:2w due:2021-03-06 +tester
Created task 19.
🚩 Europe/Berlin
Default due time has been set.
The project 'INBOX' has changed. Project 'INBOX' is 64% complete (6 of 17 tasks remaining).
jcp@kappa:~$ task do 19
Completed task 1dc9804f 'Do stuff'.
Completed 1 task.
🚩 Europe/Berlin
Created follow-up task
You have more urgent tasks.
The project 'INBOX' has changed. Project 'INBOX' is 70% complete (5 of 17 tasks remaining).
jcp@kappa:~$ Traceback (most recent call last):
[...]
ValueError: Timezone offset does not match system offset: 7200 != 0. Please, check your config files.
🚩 None
In other words: When adding or doing a task, the code works just fine, but when called by shift-recurrence the very same code breaks. As I said, I'm not a python programmer, so I will spend the rest of my working day actually working instead of looking further for the error. Sorry.
Oh. Actually it's lunchtime already. So, no working for me yet. Hooray!
PS Forgot to mention: I checked my time zone settings. Everything seems to be fine.