pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.63k stars 208 forks source link

ikhal crashes with zoneinfo attrib error adding new event #1367

Open craftyguy opened 2 weeks ago

craftyguy commented 2 weeks ago

Describe the bug

When trying to add a new event in ikhal, it crashes with AttributeError: 'zoneinfo.ZoneInfo' object has no attribute '_tzinfos'

If applicable: Stack Trace

● ikhal
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/khal/ui/__init__.py", line 1363, in start_pane
    loop.run()
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 337, in run
    self._run()
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 439, in _run
    self.event_loop.run()
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/select_loop.py", line 182, in run
    self._loop()
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/select_loop.py", line 229, in _loop
    record.data()
  File "/usr/lib/python3.12/site-packages/urwid/display/_posix_raw_display.py", line 273, in wrapper
    return self.parse_input(event_loop, callback, self.get_available_raw_input())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/display/_raw_display_base.py", line 488, in parse_input
    callback(decoded_codes, raw_codes)
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 466, in _update
    self.process_input(keys)
  File "/usr/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 566, in process_input
    handled_key = self._topmost_widget.keypress(self.screen_size, key)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/popup.py", line 143, in keypress
    return self._current_widget.keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/frame.py", line 526, in keypress
    return self.body.keypress((maxcol, remaining), key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/columns.py", line 1216, in keypress
    key = w.keypress(size_args[i], key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/widget.py", line 729, in keypress
    return get_delegate(self).keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/pile.py", line 921, in keypress
    key = self.focus.keypress(size_args[i], key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/columns.py", line 1216, in keypress
    key = w.keypress(size_args[i], key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/ui/editor.py", line 554, in keypress
    return super().keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/widget.py", line 729, in keypress
    return get_delegate(self).keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/ui/widgets.py", line 381, in keypress
    key = super().keypress(size, key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/listbox.py", line 1326, in keypress
    key = focus_widget.keypress((maxcol,), key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/columns.py", line 1216, in keypress
    key = w.keypress(size_args[i], key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/widget/wimp.py", line 762, in keypress
    self._emit("click")
  File "/usr/lib/python3.12/site-packages/urwid/widget/widget.py", line 310, in _emit
    signals.emit_signal(self, name, self, *args)
  File "/usr/lib/python3.12/site-packages/urwid/signals.py", line 298, in emit
    result |= self._call_callback(callback, user_arg, weak_args, user_args, args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urwid/signals.py", line 322, in _call_callback
    return bool(callback(*args))
                ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/ui/editor.py", line 527, in save
    self.collection.insert(self.event)
  File "/usr/lib/python3.12/site-packages/khal/khalendar/khalendar.py", line 224, in insert
    event.href, event.etag = self._storages[calendar].upload(event)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/khalendar/vdir.py", line 210, in upload
    if not isinstance(item.raw, str):
                      ^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/khalendar/event.py", line 385, in raw
    timezone = create_timezone(tzinfo, self.start)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/khalendar/event.py", line 903, in create_timezone
    for one, two in iter(tz._tzinfos.items())  # type: ignore
                         ^^^^^^^^^^^
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute '_tzinfos'

To Reproduce Steps to reproduce the behavior:

1) start ikhal 2) hit 'n' to add new event, enter anything in event title and save

Expected behavior Event added, ikhal doesn't crash

OS, version, khal version and how you installed it:

Additional context Add any other context about the problem here. Especially, if the issue came up when reading an .ics file, please provide the content of that file (anonymize if needed).

d7415 commented 2 weeks ago

This is due to a breaking change in icalendar and should be fixed by #1364.

craftyguy commented 2 weeks ago

@d7415 thanks for the pointer. I backported the functional part of that series to 0.11.3 and confirmed that it fixes this and #1366

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/74673/diffs