#1104568 khal: ikhal fails to start with LANG=C.UTF-8

Package:
khal
Source:
khal
Submitter:
Christopher Zimmermann
Date:
2025-05-02 08:45:01 UTC
Severity:
normal
Tags:
#1104568#5
Date:
2025-05-02 08:33:11 UTC
From:
To:
Dear Maintainer,

with a default locale of LANG=C.UTF-8 ikhal fails to start:

% LANG=C.UTF-8 ikhal
Traceback (most recent call last):
  File "/usr/bin/ikhal", line 5, in <module>
    main_ikhal()
    ~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/khal/cli.py", line 378, in interactive_cli
    controllers.interactive(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        build_collection(
        ^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        ctx.obj['conf']
        ^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3/dist-packages/khal/controllers.py", line 631, in interactive
    pane = ui.ClassicView(
        collection, conf, title="select an event", description="do something")
  File "/usr/lib/python3/dist-packages/khal/ui/__init__.py", line 1091, in __init__
    calendar = CAttrMap(CalendarWidget(
                        ~~~~~~~~~~~~~~^
        on_date_change=self.eventscolumn.original_widget.set_focus_date,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        get_styles=collection.get_styles
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ), 'calendar', 'calendar focus')
    ^
  File "/usr/lib/python3/dist-packages/khal/ui/calendarwidget.py", line 656, in __init__
    weekheader = _calendar.formatweekheader(2)
  File "/usr/lib/python3.13/calendar.py", line 372, in formatweekheader
    return ' '.join(self.formatweekday(i, width) for i in self.iterweekdays())
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/calendar.py", line 372, in <genexpr>
    return ' '.join(self.formatweekday(i, width) for i in self.iterweekdays())
                    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.13/calendar.py", line 622, in formatweekday
    with different_locale(self.locale):
         ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/lib/python3.13/calendar.py", line 593, in __enter__
    _locale.setlocale(_locale.LC_TIME, self.locale)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/locale.py", line 615, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting


starting with LANG= or LANG=de_DE.UTF-8 works just fine.

May it be that a default locale of C.UTF-8 is a bad idea? Then maybe the
locales package should not offer this option?


Christopher