tools-life/taskwiki

TimeZone error

MartyLake opened this issue · 11 comments

Hi,

I tried to install everything and create a few tasks, but I run into an error when I use a filterview that should output at least one task.

What's the best way to provide you more informations to diagnostize this issue ?

Best,


the stack trace of python error

"Work-Realm.wiki" 9L, 177C
Erreur détectée en traitant /mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/ftplugin/vimwiki.vim :
ligne   33 :
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/main.py", line 546, in <module>
    WholeBuffer.update_from_tw()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/main.py", line 39, in update_from_tw
    cache.evaluate_viewports()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/cache.py", line 172, in evaluate_viewports
    port.sync_with_taskwarrior()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 297, in sync_with_taskwarrior
    to_add, to_del = self.get_tasks_to_add_and_del()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 271, in get_tasks_to_add_and_del
    matching_tasks = self.matching_tasks
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 249, in matching_tasks
    task for task in self.tw.tasks.filter(*args)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 474, in __iter__
    self._result_cache = self._execute()
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 506, in _execute
    return self.backend.filter_tasks(self.filter_obj)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/backends.py", line 314, in filter_tasks
    filtered_task._load_data(json.loads(data))
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 67, in _load_data
    self._original_data = copy.deepcopy(self._data)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 328, in _reconstruct
    args = deepcopy(args, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
    y = callable(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 287, in _p
    return unpickler(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/tzinfo.py", line 526, in unpickler
    tz = pytz.timezone(zone)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 181, in timezone
    raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'local'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/main.py", line 546, in <module>
    WholeBuffer.update_from_tw()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/main.py", line 39, in update_from_tw
    cache.evaluate_viewports()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/cache.py", line 172, in evaluate_viewports
    port.sync_with_taskwarrior()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 297, in sync_with_taskwarrior
    to_add, to_del = self.get_tasks_to_add_and_del()
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 271, in get_tasks_to_add_and_del
    matching_tasks = self.matching_tasks
  File "/mnt/d/Unsaved/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 249, in matching_tasks
    task for task in self.tw.tasks.filter(*args)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 474, in __iter__
    self._result_cache = self._execute()
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 506, in _execute
    return self.backend.filter_tasks(self.filter_obj)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/backends.py", line 314, in filter_tasks
    filtered_task._load_data(json.loads(data))
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 67, in _load_data
    self._original_data = copy.deepcopy(self._data)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 328, in _reconstruct
    args = deepcopy(args, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
    y = callable(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 287, in _p
    return unpickler(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/tzinfo.py", line 526, in unpickler
    tz = pytz.timezone(zone)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 181, in timezone
    raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'local'
Appuyez sur ENTRÉE ou tapez une commande pour continuer


My setup is BashUbuntu for windows 10, with taskwarrior 2.5.1 built from source. Some dependencies were missing so I installed them with apt install. Maybe I built it with the wrong dependencies ? The "task" CLI tool seems to work OK

I would guess that the problem is that the underlying tzlocal library: https://github.com/regebro/tzlocal/ cannot determine your local timezone. While we could provide some fix (i.e. configuration option specifying the timezone explicitly), could you please raise an issue there?

According to the sources of tzlocal, it should be sufficient to corretly setup a env variable for TZ.

Hi, sorry for not answering earlier.
Can you provide the exact spot where/how you found this information ?
maybe you could detect this error during plugin loading ?

Bad news, this does not solve the issue for me. I've set the LZ variable to /etc/localtime according to (http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html), but I have the same exact issue.

$ echo $LZ
/etc/localtime

$ cat $LZ
TZif2D%▒EC▒FɐG#▒G▒▒I▒I▒▒J▒K▒▒L̿▒M▒▒N▒▒▒OnnP▒▒▒QW▒▒Rle▒S7l▒TLG▒UN▒V,)▒V▒0▒XFX▒▒Y▒(Z▒▒▒[▒
\▒]▒▒^▒_▒▒`_▒a}▒b?▒c]̐d▒e=▒▒▒▒g▒▒g藐h▒r▒i▒y▒j▒T▒k▒[▒l▒qm▒=▒n▒Soh▒p▒5qQ<rfs1tE▒uv/▒v▒▒x▒▒x▒▒y▒ِz▒▒{λ▒|▒}▒▒▒~y▒▒▒▒ DSTSTDTZif2D%▒EC▒FɐG#▒G▒▒I▒I▒▒J▒K▒▒L̿▒M▒▒N▒▒▒OnnP▒▒▒QW▒▒Rle▒S7l▒TLG▒UN▒V,)▒V▒0▒XFX▒▒Y▒(Z▒▒▒[▒
\▒]▒▒^▒_▒▒`_▒a}▒b?▒c]̐d▒e=▒▒▒▒g▒▒g藐h▒r▒i▒y▒j▒T▒k▒[▒l▒qm▒=▒n▒Soh▒p▒5qQ<rfs1tE▒uv/▒v▒▒x▒▒x▒▒y▒ِz▒▒{λ▒|▒}▒▒▒~y▒▒▒▒ DSTSTD
STD-1DST,M3.5.0/2:00:00,M10.5.0/3:00:00

$ file /etc/localtime
/etc/localtime: timezone data, version 2, 2 gmt time flags, 2 std time flags, no leap seconds, 64 transition times, 2 abbreviation chars

The underlying tzlocal library uses TZ, not LZ:

https://github.com/regebro/tzlocal/blob/master/tzlocal/unix.py#L19

if I understand correctly, the following should work:

export TZ="Europe/Prague"

Oups, my bad! But it didn't fix the issue:

$ echo $TZ
/etc/localtime

$ cat $TZ
TZif2D%▒EC▒FɐG#▒G▒▒I▒I▒▒J▒K▒▒L̿▒M▒▒N▒▒▒OnnP▒▒▒QW▒▒Rle▒S7l▒TLG▒UN▒V,)▒V▒0▒XFX▒▒Y▒(Z▒▒▒[▒
\▒]▒▒^▒_▒▒`_▒a}▒b?▒c]̐d▒e=▒▒▒▒g▒▒g藐h▒r▒i▒y▒j▒T▒k▒[▒l▒qm▒=▒n▒Soh▒p▒5qQ<rfs1tE▒uv/▒v▒▒x▒▒x▒▒y▒ِz▒▒{λ▒|▒}▒▒▒~y▒▒▒▒ DSTSTDTZif2D%▒EC▒FɐG#▒G▒▒I▒I▒▒J▒K▒▒L̿▒M▒▒N▒▒▒OnnP▒▒▒QW▒▒Rle▒S7l▒TLG▒UN▒V,)▒V▒0▒XFX▒▒Y▒(Z▒▒▒[▒
\▒]▒▒^▒_▒▒`_▒a}▒b?▒c]̐d▒e=▒▒▒▒g▒▒g藐h▒r▒i▒y▒j▒T▒k▒[▒l▒qm▒=▒n▒Soh▒p▒5qQ<rfs1tE▒uv/▒v▒▒x▒▒x▒▒y▒ِz▒▒{λ▒|▒}▒▒▒~y▒▒▒▒ DSTSTD
STD-1DST,M3.5.0/2:00:00,M10.5.0/3:00:00

$ file $TZ
/etc/localtime: timezone data, version 2, 2 gmt time flags, 2 std time flags, no leap seconds, 64 transition times, 2 abbreviation chars

Error detected while processing BufWrite Auto commands for "*.wiki":
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/mnt/c/Users/marty-dell/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/main.py", line 54, in update_to_tw
    cache.evaluate_viewports()
  File "/mnt/c/Users/marty-dell/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/cache.py", line 172, in evaluate_viewports
    port.sync_with_taskwarrior()
  File "/mnt/c/Users/marty-dell/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 297, in sync_with_taskwarrior
    to_add, to_del = self.get_tasks_to_add_and_del()
  File "/mnt/c/Users/marty-dell/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 271, in get_tasks_to_add_and_del
    matching_tasks = self.matching_tasks
  File "/mnt/c/Users/marty-dell/Dropbox/Vimrc/.vim/bundle/taskwiki/taskwiki/viewport.py", line 249, in matching_tasks
    task for task in self.tw.tasks.filter(*args)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 474, in __iter__
    self._result_cache = self._execute()
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 506, in _execute
    return self.backend.filter_tasks(self.filter_obj)
  File "/usr/local/lib/python2.7/dist-packages/tasklib/backends.py", line 314, in filter_tasks
    filtered_task._load_data(json.loads(data))
  File "/usr/local/lib/python2.7/dist-packages/tasklib/task.py", line 67, in _load_data
    self._original_data = copy.deepcopy(self._data)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 328, in _reconstruct
    args = deepcopy(args, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
    y = callable(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 287, in _p
  File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
    y = callable(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 287, in _p
    return unpickler(*args)
  File "/usr/local/lib/python2.7/dist-packages/pytz/tzinfo.py", line 526, in unpickler
    tz = pytz.timezone(zone)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 181, in timezone
    raise UnknownTimeZoneError(zone)

Try setting TZ to a "continent/city" timezone string, i.e. try Europe/Prague I used, not /etc/localtime filepath. Albeit using file is correct per docs you link, it makes tzlocal create a 'local' zone which is the root of the problem (local zones cannot be copied for some reason, I created a bug for this in tzlocal some time ago).

Nudin commented

Just a note: I also got this bug. You might want to mention the fix/workaround on the README for others to have a less frustrating start using taskwiki.

@Nudin : true, I've opened a PR for this =)