ValueError: too many values to unpack

Bug #366951 reported by Alexey Khoroshilov
2
Affects Status Importance Assigned to Milestone
language-selector
Invalid
Undecided
Unassigned
language-selector (Ubuntu)
Opinion
Low
Unassigned

Bug Description

The language-selector fails to launch after upgrade to Ubuntu 9.04. (Although I have not run it before the upgrade for long time.)

The log is as follows:
$ /usr/bin/gnome-language-selector
/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py:837: GtkWarning: gtk_cell_view_set_cell_data: assertion `cell_view->priv->displayed_row != NULL' failed
  cell = combo.get_child().get_cell_renderers()[0]
Traceback (most recent call last):
  File "/usr/bin/gnome-language-selector", line 34, in <module>
    options=options)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 171, in __init__
    self.updateUserDefaultCombo()
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 58, in wrapper
    res = f(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 856, in updateUserDefaultCombo
    COMBO_LANGUAGE,self._localeinfo.translate(locale),
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/LocaleInfo.py", line 135, in translate
    (lang, country) = string.split(locale, "_")
ValueError: too many values to unpack
$ lsb_release -d
Description: Ubuntu 9.04

Which config files should I to attach?

Tags: jaunty
Revision history for this message
Arne Goetje (arnegoetje) wrote :

Does this still happen with the latest version (0.5.1) on Lucid?
If yes, which locale are you using?

Changed in language-selector:
status: New → Invalid
Changed in language-selector (Ubuntu):
status: New → Incomplete
Revision history for this message
Alexey Khoroshilov (khoroshilov) wrote :

It happens with the version 0.4.18 on Karmik. I am not sure I am able to upgrade my system to Lucid now.
But diagnostic has been changed a little:

$ /usr/bin/gnome-language-selector
/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/SimpleGtkbuilderApp.py:40: RuntimeWarning: missing handler 'on_combobox_locale_chooser_changed'
  self.builder.connect_signals(self)
/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/SimpleGtkbuilderApp.py:40: RuntimeWarning: missing handler 'on_button_apply_system_wide_clicked'
  self.builder.connect_signals(self)
/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py:871: GtkWarning: gtk_cell_view_set_cell_data: assertion `cell_view->priv->displayed_row != NULL' failed
  cell = combo.get_child().get_cell_renderers()[0]
Traceback (most recent call last):
  File "/usr/bin/gnome-language-selector", line 32, in <module>
    options=options)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 177, in __init__
    self.updateUserDefaultCombo()
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 58, in wrapper
    res = f(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 890, in updateUserDefaultCombo
    COMBO_LANGUAGE,self._localeinfo.translate(locale),
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/LocaleInfo.py", line 154, in translate
    (lang_name, country_name) = self.translate_locale(locale)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/LocaleInfo.py", line 142, in translate_locale
    country_name = gettext.dgettext('iso_3166', self._country[country])
KeyError: ''

As for locales, I suppose the problematic locale can be the 'en_POSIX_test_dec' that has been installed using the following command:
> localedef -c -f UTF-8 -i /opt/lsb/test/desktop-t2c/locale/POSIX_test_dec.ldf en_POSIX_test_dec

where POSIX_test_dec.ldf is as follows:
LC_CTYPE
copy "POSIX"
END LC_CTYPE

LC_COLLATE
copy "POSIX"
END LC_COLLATE

LC_MONETARY
copy "POSIX"
END LC_MONETARY

LC_NUMERIC
# This is the modified POSIX locale definition for
# the LC_NUMERIC category.
#
decimal_point ","
thousands_sep ""
grouping -1
#
END LC_NUMERIC

LC_TIME
copy "POSIX"
END LC_TIME

LC_MESSAGES
copy "POSIX"
END LC_MESSAGES

Arne Goetje (arnegoetje)
Changed in language-selector (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Arne Goetje (arnegoetje) wrote :

Thanks for your feedback.
The bug is that you use an unsupported locale ('C' and '*POSIX*' locales are unsupported in language-selector, since there are no translations available for those locales. Strings in applications can be in *any* language which uses the ASCII charset, it's not necessrily English, although in the vast majority of applications they are one of the English variants.

The current solution is to fall back to 'en_US' for such cases, but that may overwrite your custom language settings, which you might have set for specific reason.

The proper solution I would propose is to display a dialogbox to the user, remind him that he uses an unsupported locale and ask him if he wants to switch to the default system language or 'en_US' if the system language is also unsupported.
The code may even try to parse the unsupported localecode for any hint what the primary language it is (in case of en_POSIX_*, that would be 'en' -> English). If the user decides to keep the unsupported locale, language-selector should do nothing and just keep everything like it is.

Set the milestone to 'Later', since we are in string freeze already for Lucid. This would be a problem to solve for Lucid+1.

Changed in language-selector (Ubuntu):
importance: Undecided → Low
milestone: none → later
papukaija (papukaija)
summary: - [jaunty] ValueError: too many values to unpack
+ ValueError: too many values to unpack
tags: added: jaunty
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

By using a non-utf8 locale on an Ubuntu desktop, you ask for trouble. I don't see a strong enough reason to make language-selector deal with it.

Changed in language-selector (Ubuntu):
status: Triaged → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.