pimutils / khal

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

khal crashes while searching in interactive mode #1349

Open clustor opened 1 month ago

clustor commented 1 month ago

Describe the bug When I press '/' to search for events in interactive mode, khal crashes

If applicable: Stack Trace

Traceback (most recent call last):
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/khal/ui/__init__.py", line 1363, in start_pane
    loop.run()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 343, in run
    self._run()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 445, in _run
    self.event_loop.run()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/select_loop.py", line 182, in run
    self._loop()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/select_loop.py", line 229, in _loop
    record.data()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/display/_posix_raw_display.py", line 274, in wrapper
    return self.parse_input(event_loop, callback, self.get_available_raw_input())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/display/_raw_display_base.py", line 489, in parse_input
    callback(decoded_codes, raw_codes)
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 472, in _update
    self.process_input(keys)
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/event_loop/main_loop.py", line 572, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)  # noqa: PLW2901
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/widget/popup.py", line 140, in keypress
    return self._current_widget.keypress(size, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/widget/frame.py", line 451, in keypress
    return self.body.keypress((maxcol, remaining), key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/khal/ui/__init__.py", line 1122, in keypress
    self.search()
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/khal/ui/__init__.py", line 1127, in search
    overlay = urwid.Overlay(
              ^^^^^^^^^^^^^^
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/widget/overlay.py", line 166, in __init__
    self.set_overlay_parameters(align, width, valign, height, min_width, min_height, left, right, top, bottom)
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/widget/overlay.py", line 459, in set_overlay_parameters
    self.options(
  File "/usr/local/Cellar/khal/0.11.3/libexec/lib/python3.12/site-packages/urwid/widget/overlay.py", line 362, in options
    VAlign(valign_type),
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: <WHSettings.RELATIVE: 'relative'> is not a valid VAlign

To Reproduce

  1. khal interactive
  2. Press '/'

Expected behavior

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

geier commented 1 month ago

Thanks for reporting this issue.

I believe this should be fixed with upgrading urwid, see https://github.com/pimutils/khal/issues/1340

clustor commented 1 month ago

Thanks for pointing me to the root cause ticket. I am trying to determine the best way to upgrade urwid with brew. I see that urwid 2.5.3 is installed from https://github.com/Homebrew/homebrew-core/blob/ef5d63c5ec3ff5a25c63c240ae13d4bb51c5183a/Formula/k/khal.rb

But #1340 references urwid 2.6.8 fixes this. Would you mind pushing a release updating the min version of urwid required https://github.com/pimutils/khal/blob/master/pyproject.toml#L30 ? May be macos brew will pick this up then automatically. I need to dig a bit to understand brew ecosystem for this.

Until then, I will use khal from a virtual env.