gtg icon indicating copy to clipboard operation
gtg copied to clipboard

AttributeError: 'datetime.date' object has no attribute 'tzinfo' in gtg 0.6 from flathub

Open danhansen opened this issue 2 years ago • 1 comments

I just installed gtg 0.6 from flathub and when I load the app, it encounters the following errror:

2022-09-07 23:29:00,649 - INFO - backend_caldav:_do_periodic_import:137 - Running periodic import
2022-09-07 23:29:02,040 - INFO - backend_caldav:_do_periodic_import:144 - Fetching todos from 'https://hosted.mailcow.de/SOGo/dav/dan%40silentsierra.com/Calendar/personal/'
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 185, in transformToNative
    return self.behavior.transformToNative(self)
  File "/app/lib/python3.9/site-packages/vobject/icalendar.py", line 757, in transformToNative
    if obj.value.tzinfo is None:
AttributeError: 'datetime.date' object has no attribute 'tzinfo'

During handling of the above exception, another exception occurred:

  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/app/lib/python3.9/site-packages/GTG/core/datastore.py", line 499, in __backend_startup
    backend.start_get_tasks()
  File "/app/lib/python3.9/site-packages/GTG/core/datastore.py", line 694, in start_get_tasks
    self.backend.start_get_tasks()
  File "/app/lib/python3.9/site-packages/GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "/app/lib/python3.9/site-packages/GTG/backends/periodic_import_backend.py", line 79, in start_get_tasks
    self._start_get_tasks()
  File "/app/lib/python3.9/site-packages/GTG/backends/periodic_import_backend.py", line 98, in _start_get_tasks
    self.do_periodic_import()
  File "/app/lib/python3.9/site-packages/GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "/app/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 111, in do_periodic_import
    self._do_periodic_import()
  File "/app/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 145, in _do_periodic_import
    self._import_calendar_todos(calendar, start, counts)
  File "/app/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 285, in _import_calendar_todos
    todos = calendar.todos(include_completed=not self._cache.initialized)
  File "/app/lib/python3.9/site-packages/caldav/objects.py", line 884, in todos
    matches.sort(key=sort_key_func)
  File "/app/lib/python3.9/site-packages/caldav/objects.py", line 850, in sort_key_func
    vtodo = x.instance.vtodo
  File "/app/lib/python3.9/site-packages/caldav/objects.py", line 1516, in _get_vobject_instance
    self._set_vobject_instance(vobject.readOne(to_unicode(self._get_data())))
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 1155, in readOne
    return next(readComponents(stream, validate, transform, ignoreUnreadable,
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 1128, in readComponents
    component.transformChildrenToNative()
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 674, in transformChildrenToNative
    child.transformChildrenToNative()
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 673, in transformChildrenToNative
    child = child.transformToNative()
  File "/app/lib/python3.9/site-packages/vobject/base.py", line 198, in transformToNative
    raise ParseError(msg, lineNumber)
vobject.base.ParseError: At line 61: In transformToNative, unhandled exception on line 61: <class 'AttributeError'>: 'datetime.date' object has no attribute 'tzinfo' (<COMPLETED{'VALUE': ['DATE']}20210103>)`

This appears to render gtg incapable of syncing with caldav.

danhansen avatar Sep 08 '22 03:09 danhansen

It seems that there was a really old completed task on my caldav server that was malformed or something, because I deleted all of the completed/stale tasks and this issue went away. Thus, I don't think it is a showstopping bug...it may just be that the code needs to be made a little more tolerant of malformed data from the caldav server...

danhansen avatar Sep 19 '22 16:09 danhansen