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 Wikimedia Cloud VPS.

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

Support and administration of the WMCS resources is provided by the Wikimedia Foundation Cloud Services team and Wikimedia movement volunteers. Please reach out with questions and join the conversation:


Discuss and receive general support
Receive mail announcements about critical changes
Subscribe to the cloud-announce@ mailing list (all messages are also mirrored to the cloud@ list)
Track work tasks and report bugs
Use the Phabricator workboard #Cloud-Services for bug reports and feature requests about the Cloud VPS infrastructure itself
Learn about major near-term plans
Read the News wiki page
Read news and stories about Wikimedia Cloud Services
Read the Cloud Services Blog (for the broader Wikimedia movement, see the Wikimedia Technical Blog)