Help:Locale errors

From Wikitech
Jump to navigation Jump to search


Overview

Locale errors are associated with the language of a system. These typically occur on new instances in the Wikimedia Labs cluster (running Ubuntu 12.04/precise).

This page will show you how to solve this issue.

How do locale errors happen?

Using the pywikipediabot's interwiki.py script as an example here.

Immediately after creating the new instance that you would like to use, you may see errors like:

Python
Traceback (most recent call last):
  File "interwiki.py", line 375, in <module>
    import wikipedia as pywikibot
  File "/home/hydriz/pywikipedia/wikipedia.py", line 147, in <module>
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_SG.UTF-8",
	LC_MONETARY = "en_SG.UTF-8",
	LC_ADDRESS = "en_SG.UTF-8",
	LC_TELEPHONE = "en_SG.UTF-8",
	LC_NAME = "en_SG.UTF-8",
	LC_MEASUREMENT = "en_SG.UTF-8",
	LC_IDENTIFICATION = "en_SG.UTF-8",
	LC_NUMERIC = "en_SG.UTF-8",
	LC_PAPER = "en_SG.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

Such errors can break the interwiki bot script, making the script totally useless on that instance.

Solution

Run the following command to install the required language packs:

sudo apt-get install language-pack-en-base

And to also rebuild it again to ensure it works:

sudo dpkg-reconfigure locales

...and you are done!

Communication and support

We communicate and provide support through several primary channels. Please reach out with questions and to join the conversation.

Communicate with us
Connect Best for
Phabricator Workboard #Cloud-Services Task tracking and bug reporting
IRC Channel #wikimedia-cloud connect General discussion and support
Mailing List cloud@ Information about ongoing initiatives, general discussion and support
Announcement emails cloud-announce@ Information about critical changes (all messages mirrored to cloud@)
News wiki page News Information about major near-term plans
Cloud Services Blog Clouds & Unicorns Learning more details about some of our work
Wikimedia Technology Blog techblog.wikimedia.org News and stories from the Wikimedia technical movement