After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680964 - Unable to set locale
Unable to set locale
Status: RESOLVED FIXED
Product: gaupol
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gaupol-maint@gnome.bugs
gaupol-maint@gnome.bugs
: 677814 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-08-01 10:49 UTC by azephel
Modified: 2012-08-01 20:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description azephel 2012-08-01 10:49:33 UTC
Just when I opened a .ass file with a right click, nothing happened but that :

Traceback

File: usr/bin/gaupol
Line: 28
In: <module>

    gaupol.main.main(sys.argv[1:])

File: usr/share/gaupol/gaupol/main.py
Line: 175
In: main

    _init_gettext()

File: usr/share/gaupol/gaupol/main.py
Line: 81
In: _init_gettext

    locale.setlocale(locale.LC_ALL, "")

File: usr/lib/python2.7/locale.py
Line: 539
In: setlocale

    return _setlocale(category, locale)

Error: unsupported locale setting

Environment

Platform: Linux-3.2.0-23-generic-i686-athlon-with-LinuxMint-13-maya
Locale: fr_FR.ascii

Libraries

Python: 2.7.3
GTK+: 2.24.10
GStreamer: 0.10.36.0

Python Packages

aeidon: 0.19.2
gaupol: 0.19.2
gtk: 2.24.0
gst: 0.10.22
enchant: 1.6.5
chardet: 2.0.1
Comment 1 azephel 2012-08-01 10:51:03 UTC
Same thing happen every time I try to open Gaupol.
Comment 2 Osmo Salomaa 2012-08-01 19:25:57 UTC
I have received a similar bug report before (#677814), but I didn't receive needed additional info. That was from a LinuxMint-13-maya user as well. Mint might be doing something weird with locale definitions and I would need to know the details.

Can you please open a terminal window, enter command "locale" and paste the output here?
Comment 3 Osmo Salomaa 2012-08-01 19:29:53 UTC
*** Bug 677814 has been marked as a duplicate of this bug. ***
Comment 4 azephel 2012-08-01 19:38:51 UTC
No problem, here is the output of the "locale" command :


locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

As you can see I'm french, so first I thought french isn't a supported language, but I don't think so.
Comment 5 Osmo Salomaa 2012-08-01 19:50:24 UTC
Hmm-- those first three lines look alarming.

Could you also paste the output of "locale -a"? That should tell us what locales are actually installed and available for use.
Comment 6 azephel 2012-08-01 19:58:39 UTC
yep, it's not the first time I see them.

Here's the output of "locale -a" :


locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
de_CH.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
zh_CN.utf8
zh_SG.utf8

Hope that will help !
Comment 7 Osmo Salomaa 2012-08-01 20:07:57 UTC
OK. It seems your locale definitions are a mess. The environment variables instruct the use of "fr_FR.UTF-8", which is apparently not available.

Try running "sudo dpkg-reconfigure locales" at a terminal window. At the first prompt, make sure to select "fr_FR.UTF-8" (you can also deselect ones you don't use) and at the second prompt select "fr_FR.UTF-8" as the default. After that, try running "locale" and "locale -a" again to see if the output has changed.
Comment 8 azephel 2012-08-01 20:17:33 UTC
Nothing prompted after a dpkg-reconfigure locales, but the three demoniac lines seems to be exorcised. Here is the output of "dpkg-reconfigure locales" :


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "fr_FR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  en_CA.UTF-8... done
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... hash collision (1688509771) en_HK.utf8, de_CH.utf8
failed
  en_IE.UTF-8... done
  en_IN.UTF-8... done
  en_NG.UTF-8... done
  en_NZ.UTF-8... done
  en_PH.UTF-8... done
  en_SG.UTF-8... done
  en_US.UTF-8... done
  en_ZA.UTF-8... done
  en_ZM.UTF-8... done
  en_ZW.UTF-8... done
  fr_FR.UTF-8... done
Generation complete.

And the output for "locale -a" :


C
C.UTF-8
de_CH.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
fr_FR.utf8
POSIX
zh_CN.utf8
zh_SG.utf8

And Gaupol works fine now !
Comment 9 Osmo Salomaa 2012-08-01 20:51:02 UTC
OK. I made gaupol slightly more tolerant for the future. No more crash for users with misconfigured locales, but instead a fall back to the 'C' locale (English, ASCII, etc.) and appropriate warning messages to stderr.

commit 7d01a916e7fd1e2a80782070a2a84c8a4116e5bd
Author: Osmo Salomaa <otsaloma@iki.fi>
Date:   Wed Aug 1 23:39:48 2012 +0300

    Fall back to the 'C' locale if locale.setlocale fails.
    
    locale.setlocale might fail to set the default locale if that locale is
    not actually installed and/or configured correctly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680964
Comment 10 azephel 2012-08-01 20:55:04 UTC
Thanks, happy to be helpful :)