calendar-cli icon indicating copy to clipboard operation
calendar-cli copied to clipboard

AttributeError: 'datetime.date' object has no attribute 'astimezone'

Open bwurst opened this issue 3 years ago • 3 comments

When I issue the command calendar-cli calendar agenda against my nextcloud 20.0 server, I get the error

  File "/usr/local/lib/python3.9/dist-packages/calendar_cli-0.12.1-py3.9.egg/EGG-INFO/scripts/calendar-cli", line 992, in <module>
  File "/usr/local/lib/python3.9/dist-packages/calendar_cli-0.12.1-py3.9.egg/EGG-INFO/scripts/calendar-cli", line 983, in main
  File "/usr/local/lib/python3.9/dist-packages/calendar_cli-0.12.1-py3.9.egg/EGG-INFO/scripts/calendar-cli", line 534, in calendar_agenda
AttributeError: 'datetime.date' object has no attribute 'astimezone'

when an all day event is to be displayed. When no such event is visible in the specified date range, the error goes away.

calendar-cli is installed in debian stable.

bwurst avatar Sep 28 '21 06:09 bwurst

Seems familiar. I discovered some similar problems on Ubuntu the other day while running tests for the caldav library, and I made a fix for it in the caldav library. I'll have a look.

tobixen avatar Sep 28 '21 06:09 tobixen

No, it was a different problem I had in the caldav library. In your traceback, the calendar-cli is trying to fix timezone info for a date - and that breaks, a date cannot have time zone data applied to it. I've made a quick fix now in master (without testing - I'm a bit in a rush now). I should probably investigate deeper a bit later (code looks quite complex, could it be refactored?).

tobixen avatar Sep 28 '21 07:09 tobixen

Thanks a lot! I tried it, the current git version fixes this problem for me!

bwurst avatar Sep 28 '21 08:09 bwurst