khal icon indicating copy to clipboard operation
khal copied to clipboard

ikhal crashes with zoneinfo attrib error adding new event

Open craftyguy opened this issue 1 year ago • 8 comments

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:

  • The output of khal --version: ikhal, version 0.11.3
  • Installation method [e.g. PyPI, git, OS repo]: distro repo
  • python version [e.g. python 3.9]: 3.12
  • OS [e.g. arch]: Alpine Linux (edge)
  • Your khal config file
  • The versions of your other python packages [e.g. the output of pip freeze]

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).

craftyguy avatar Nov 04 '24 19:11 craftyguy

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

d7415 avatar Nov 04 '24 23:11 d7415

@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

craftyguy avatar Nov 05 '24 03:11 craftyguy

I'm in 0.11.3 but I got the same error: which version of khal shall I install to be able to add new events?

(I'm using vdirsyncer: perhaps I should rather downgrade vdirsyncer? Do you know to which version?)

Thanks!

cerisara avatar Nov 30 '24 08:11 cerisara

I'm in 0.11.3 but I got the same error: which version of khal shall I install to be able to add new events?

#1364 is needed to address that but it is not merged so no releases contain that fix at the moment.

(I'm using vdirsyncer: perhaps I should rather downgrade vdirsyncer? Do you know to which version?)

vdirsyncer is unrelated. It depends on icalendar Python package. If you can downgrade icalendar to a 5.x version it should avoid that problem.

iamleot avatar Nov 30 '24 09:11 iamleot

OK, it indeed works with

pip install icalendar==5.0.13

Thanks!

Le Sat, Nov 30, 2024 at 01:53:35AM -0800, Leonardo Taccari a écrit :

I'm in 0.11.3 but I got the same error: which version of khal shall I install to be able to add new events?

#1364 is needed to address that but it is not merged so no releases contain that fix at the moment.

(I'm using vdirsyncer: perhaps I should rather downgrade vdirsyncer? Do you know to which version?)

vdirsyncer is unrelated. It depends on icalendar Python package. If you can downgrade icalendar to a 5.x version it should avoid that problem.

-- Reply to this email directly or view it on GitHub: https://github.com/pimutils/khal/issues/1367#issuecomment-2508906082 You are receiving this because you commented.

Message ID: @.***>

cerisara avatar Nov 30 '24 13:11 cerisara

Hey, i tried to fix it on https://github.com/pimutils/khal/pull/1374#issue-2708349656

syasma avatar Dec 01 '24 03:12 syasma

I just installed khal for the first time today to try it out. Adding a new event already failed on this error. Installed with brew install khal Does this mean khal is not really supported for macOS homebrew users? Is there a workaround?

micheldebree avatar Feb 01 '25 09:02 micheldebree

Like @micheldebree I also installed through brew and am facing this issue. Any update?

nbbaier avatar Mar 01 '25 16:03 nbbaier