Unsupported locale setting python windows

[This answer is target on linux platform only]

The first thing you should know is most of the locale config file located path can be get from localedef --help :

$ localedef --help | tail -n 5
System's directory for character maps : /usr/share/i18n/charmaps
                       repertoire maps: /usr/share/i18n/repertoiremaps
                       locale path    : /usr/lib/locale:/usr/share/i18n
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>

See the last /usr/share/i18n ? This is where your xx_XX.UTF-8 config file located:

$ ls /usr/share/i18n/locales/zh_*
/usr/share/i18n/locales/zh_CN  /usr/share/i18n/locales/zh_HK  /usr/share/i18n/locales/zh_SG  /usr/share/i18n/locales/zh_TW

Now what ? We need to compile them into archive binary. One of the way, e.g. assume I have /usr/share/i18n/locales/en_LOVE, I can add it into compile list, i.e. /etc/locale-gen file:

$ tail -1 /etc/locale.gen 
en_LOVE.UTF-8 UTF-8

And compile it to binary with sudo locale-gen:

$ sudo locale-gen 
Generating locales (this might take a while)...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  ...
  en_LOVE.UTF-8... done
Generation complete.

And now update the system default locale with desired LANG, LC_ALL …etc with this update-locale:

sudo update-locale LANG=en_LOVE.UTF-8

update-locale actually also means to update this /etc/default/locale file which will source by system on login to setup environment variables:

$ head /etc/default/locale 
#  File generated by update-locale
LANG=en_LOVE.UTF-8
LC_NUMERIC="en_US.UTF-8"
...

But we may not want to reboot to take effect, so we can just source it to environment variable in current shell session:

$ . /etc/default/locale

How about sudo dpkg-reconfigure locales ? If you play around it you will know this command basically act as GUI to simplify the above steps, i.e. Edit /etc/locale.gen -> sudo locale-gen -> sudo update-locale LANG=en_LOVE.UTF-8

For python, as long as /etc/locale.gen contains that locale candidate and locale.gen get compiled, setlocale(category, locale) should work without throws locale.Error: unsupoorted locale setting. You can check the correct string en_US.UTF-8/en_US/....etc to be set in setlocale(), by observing /etc/locale.gen file, and then uncomment and compile it as desired. zh_CN GB2312 without dot in that file means the correct string is zh_CN and zh_CN.GB2312.

When running a Python script, you may encounter the «unsupported locale setting» error, which typically appears as follows:

locale.Error: unsupported locale setting

This error occurs because the locale settings of your system are not supported by Python’s locale module. The locale module uses the locale settings to perform locale-aware operations, such as formatting dates and times, currency, and sorting strings in a specific language-sensitive order.

Method 1: Set the locale environment variables

If you are facing the «unsupported locale setting» error in Python, it means that your system does not have the required locale settings installed. One way to fix this issue is by setting the locale environment variables. Here’s how you can do it:

  1. Import the locale module:
  1. Set the locale environment variables:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

Here, we are setting the locale to en_US.UTF-8. You can replace this with the locale that you want to use.

  1. Verify the locale:
print(locale.getlocale())

This will print the current locale settings. You should see the locale that you set in step 2.

  1. Use the locale module in your code:
formatted_number = locale.format_string("%d", 123456789, grouping=True)
print(formatted_number)

Here, we are using the locale.format_string method to format a number with grouping (thousands separator). This will use the locale settings that we set in step 2.

That’s it! You have successfully set the locale environment variables in Python. Here’s the complete code:

import locale

locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
print(locale.getlocale())

formatted_number = locale.format_string("%d", 123456789, grouping=True)
print(formatted_number)

Method 2: Install the missing locale

To fix the Python locale error «unsupported locale setting», you can try installing the missing locale. Here are the steps to do it:

  1. Check the current locale settings by running the command locale in the terminal. You will see a list of locale settings, such as LANG, LC_ALL, LC_CTYPE, etc. Take note of the current settings.

  2. Identify the missing locale. The error message usually indicates which locale is missing. For example, it could be «en_US.UTF-8» or «de_DE.UTF-8».

  3. Install the missing locale by running the following command in the terminal:

    Replace <locale> with the missing locale, such as «en_US.UTF-8» or «de_DE.UTF-8». This command generates the locale files for the specified locale.

  4. Update the locale settings by running the following command in the terminal:

    This command updates the system-wide locale settings based on the current values of environment variables.

  5. Verify that the missing locale is now available by running the command locale -a in the terminal. You should see the missing locale in the list of available locales.

Here’s an example code snippet that installs the missing locale «en_US.UTF-8»:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

$ sudo locale-gen en_US.UTF-8
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

$ sudo update-locale
Generating locales (this might take a while)...
  en_US.UTF-8... up-to-date
Generation complete.

$ locale -a
C
en_US.utf8
POSIX

In this example, the missing locale «en_US.UTF-8» was installed successfully and is now available in the list of available locales.

Method 3: Use a default locale

To fix the Python locale error «unsupported locale setting», you can use a default locale. Here are the steps to do it:

  1. Import the locale module:
  1. Set the default locale using the setlocale() function. This function takes two arguments: the first argument is the category, which specifies the type of locale to use (e.g. LC_ALL, LC_CTYPE, LC_NUMERIC, etc.), and the second argument is the locale to use (e.g. «en_US.UTF-8», «es_ES.UTF-8», etc.). In this case, we will set the default locale to «C»:
locale.setlocale(locale.LC_ALL, 'C')
  1. Now you can try running your Python program again, and the locale error should be resolved.

Here is the complete code:

import locale

locale.setlocale(locale.LC_ALL, 'C')

Note that setting the default locale to «C» may not be appropriate for all situations. You may need to set the locale to a different value depending on your specific needs.

Method 4: Change the default locale for Python

If you are getting a «unsupported locale setting» error in Python, you can fix it by changing the default locale for Python. Here are the steps to do it:

  1. Import the locale module:
  1. Set the default locale to a valid one. For example, «en_US.UTF-8» for English language and UTF-8 encoding:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
  1. Test if the default locale is set correctly by printing it:
print(locale.getlocale())
  1. If you get a «locale.Error: unsupported locale setting» error, it means that the locale you set is not available on your system. You can check the available locales by running the following command in your terminal:
  1. Choose a valid locale from the list and set it as the default locale:
locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')
  1. Test again if the default locale is set correctly:
print(locale.getlocale())
  1. If you want to change the default locale permanently, you can add the following line to your ~/.bashrc file:
export LC_ALL=en_US.UTF-8
  1. Save the file and run the following command to reload it:
  1. Now you should be able to run your Python code without getting the «unsupported locale setting» error.

Here’s the complete code:

import locale

locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

print(locale.getlocale())

locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')

print(locale.getlocale())

I hope this helps you fix the «unsupported locale setting» error in Python. Let me know if you have any questions!

  1. What Is the Locale Module in Python
  2. What Is the locale.Error: unsupported locale setting in Python
  3. How to Fix the locale.Error: unsupported locale setting in Python
  4. Fix the locale.Error: unsupported locale setting With the export Command
  5. Fix the locale.Error: unsupported locale setting From Your Terminal
  6. Enlist All the Available Languages in the Locale Module

Locale.Error: Unsupported Locale Setting in Python

Python is a diverse and powerful programming language with many libraries and frameworks that allow you to achieve the desired tasks efficiently.

Regarding taking care of developers, Python is always on the top. Here is one of the famous modules to help developers generalize the software without facing any cultural barriers, and that module is Locale.

What Is the Locale Module in Python

As discussed, the locale module is developed to facilitate the developers to deal with certain cultural issues in the software.

So let’s explore the Locale module and try to fix one of the most common errors, locale.Error: unsupported locale setting you will encounter when you are new to this module.

Before going into the details of the error, let’s see what the locale module is, how to import it, and what else is required in this module.

Code example:

import locale

# get the current locale
print(locale.getlocale())

Output:

('English_United States', '1252')

We have English_United States.1252 as the preferred locale in our case; basically, it depends on the settings; you might have a different preferred locale on your machines.

But you can change the default locale into your preferred locale from the available list with the help of the setlocale() function.

locale.setlocale(locale.LC_ALL, 'German')

Output:

What Is the locale.Error: unsupported locale setting in Python

In Python, when you are new to the locale module, you might encounter the locale.Error: unsupported locale setting at some point. And the reasons behind that you didn’t have either properly installed the locale module or issues with the parameters you are providing.

Let’s see an example to understand the locale.Error: unsupported locale setting in a better way.

import locale
print(str(locale.getlocale()))
locale.setlocale(locale.LC_ALL, 'de_DE')

Output:

locale.Error: unsupported locale setting

And the core reason behind this error is that your environment variable LC_ALL is missing or invalid. In this case, de_DE is missing, so you get the error locale.Error: unsupported locale setting.

How to Fix the locale.Error: unsupported locale setting in Python

As we have seen in the above code, it has caused the locale error, and the reason was we were missing the environment variables, or the provided one was invalid. And to fix that, there are multiple solutions; each is explained one by one, so make sure to check out each to fix the locale.Error: unsupported locale setting.

Let’s begin with setting the environment variables. To do so, go to your terminal and type the following commands.

Fix the locale.Error: unsupported locale setting With the export Command

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

You can also do it in one line of code. Both work the same.

export LC_ALL="en_US.UTF-8" & export LC_CTYPE="en_US.UTF-8" & sudo dpkg-reconfigure locales

In the above commands, the LC_ALL and LC_CTYPE are used to set the environment variables, and the last command sudo dpkg-reconfigure locales is used to commit the changes into the system.

Fix the locale.Error: unsupported locale setting From Your Terminal

If that didn’t work for you, you could try to reinstall locale from your terminal.

sudo apt-get install locales -y

The above command will install locale. Now generate a list of locales with the locale-gen command.

sudo locale-gen en_US.UTF-8

And finally, set the configuration permanently to the system.

sudo echo "LANG=en_US.UTF-8" > /etc/default/locale

Running the above commands might ask you to restart your machine; you should allow it to restart.

Enlist All the Available Languages in the Locale Module

You can run the below command or the Python program to verify that the given locale exists in the locale list.

Below is the Python program to see the list of available locales.

import locale
for language in locale.windows_locale.values():
    print(language, end =", ")

Output:

af_ZA, sq_AL, gsw_FR, am_ET, de_DE, de_CH, ....., sah_RU, ii_CN, yo_NG, zu_ZA

The above program will loop through the available list of locale languages and print each as shown in the output. Now you can pick anything available in the list and put it in the program to see its output, which should work properly.

Code Example:

import locale
print(str(locale.getlocale()))
locale.setlocale(locale.LC_ALL, 'de_DE')

Output:

('de_DE', 'UTF-8')
'de_DE'

Perfect! As you can see, it is working perfectly; we have set the locale language as de_DE as it’s running smoothly.

Remember de_DE exists in the list of the local languages, as shown in the above example, and it represents the German language.

In trying to get python to spit out names in specific locale I landed here with same problem.

In pursuing the answer, things got a little mystical I find.

I found that python code.

import locale
print locale.getdefaultlocale()
>> ('en_DK', 'UTF-8')

And indeed locale.setlocale(locale.LC_TIME, 'en_DK.UTF-8') works

Using tips here I tested further to see what is available using python code

import locale
loc_list = [(a,b) for a,b in locale.locale_alias.items() ]
loc_size = len(loc_list)
print loc_size,'entries'

for loc in loc_list:
    try:
        locale.setlocale(locale.LC_TIME, loc[1])
        print 'SUCCES set {:12} ({})'.format(loc[1],loc[0])
    except:
        pass

which yields

858 entries
SUCCES set en_US.UTF-8  (univ)
SUCCES set C            (c.ascii)
SUCCES set C            (c.en)
SUCCES set C            (posix-utf2)
SUCCES set C            (c)
SUCCES set C            (c_c)
SUCCES set C            (c_c.c)
SUCCES set en_IE.UTF-8  (en_ie.utf8@euro)
SUCCES set en_US.UTF-8  (universal.utf8@ucs4)
SUCCES set C            (posix)
SUCCES set C            (english_united-states.437)
SUCCES set en_US.UTF-8  (universal)

Of which only above is working! But the en_DK.UTF-8 is not in this list, though it works!?!? What??
And the python generated locale list do contain a lot of combos of da and DK, which I am looking for, but again no UTF-8 for da/DK…

I am on a Point Linux distro (Debian based), and here locale says amongst other LC_TIME="en_DK.UTF-8", which I know works, but not the locale I need.

locale -a says

C
C.UTF-8
en_DK.utf8
en_US.utf8
POSIX

So definitely need to install other locale, which i did by editing /etc/locale.gen, uncomment needed line da_DK.UTF-8 UTF-8 and run command locale-gen

Now locale.setlocale(locale.LC_TIME, 'da_DK.UTF-8') works too, and I can get my localized day and month names.

My Conclision:

Python : locale.locale_alias is not at all helpfull in finding available locales!!!

Linux : It is quite easy to get locale list and install new locale. A lot of help available.

Windows : I have been investigating a little, but nothing conclusive. There are though posts leading to answers, but I have not felt the urge to pursue it.

Answer by Calum Campbell

This error can occur, if you have just added a new locale. You need to restart the python interactive shell (quit() and python) to get access to it.,To install a new locale use:,This file can either be adjusted manually or updated using the tool, update-locale.,run locale-gen to generate newly added locales

Run following commands

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

Answer by Layton Dodson

While you can set the locale exporting an environment variable, you will have to do that every time you start a session, meaning after a restart, things would go back the same as before. Setting a locale the following way will solve the problem permanently.,You’ve been fiddling with the environment variables then try to use pip,The root cause is: your environment variable LC_ALL is missing or invalid somehow,If you want to solve it quick, you can sequentially run the commands below in the terminal :

The root cause is: your environment variable LC_ALL is missing or invalid somehow

.wp-block-code{border:0;padding:0}.wp-block-code>div{overflow:auto}.shcb-language{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal;word-break:normal}.hljs{box-sizing:border-box}.hljs.shcb-code-table{display:table;width:100%}.hljs.shcb-code-table>.shcb-loc{color:inherit;display:table-row;width:100%}.hljs.shcb-code-table .shcb-loc>span{display:table-cell}.wp-block-code code.hljs:not(.shcb-wrap-lines){white-space:pre}.wp-block-code code.hljs.shcb-wrap-lines{white-space:pre-wrap}.hljs.shcb-line-numbers{border-spacing:0;counter-reset:line}.hljs.shcb-line-numbers>.shcb-loc{counter-increment:line}.hljs.shcb-line-numbers .shcb-loc>span{padding-left:.75em}.hljs.shcb-line-numbers .shcb-loc::before{border-right:1px solid #ddd;content:counter(line);display:table-cell;padding:0 .75em;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:1%}➜  ~ pip install virtualenv
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib64/python3.4/locale.py", line 592, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Code language: Bash (bash)

If you want to solve it quick, you can sequentially run the commands below in the terminal :

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure localesCode language: Bash (bash)

Here is a one-liner for you the lazy guys :

export LC_ALL="en_US.UTF-8" & export LC_CTYPE="en_US.UTF-8" & sudo dpkg-reconfigure localesCode language: Bash (bash)

The output should look like this :

~$ export LC_ALL="en_US.UTF-8" & export LC_CTYPE="en_US.UTF-8" & sudo dpkg-reconfigure locales

[1] 7201
[2] 7202
[sudo] password for user: 
Generating locales (this might take a while)...
  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... done
  en_IE.UTF-8... done
  en_IL.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
  vi_VN.UTF-8... done
Generation complete.
[1]-  Done                    export LC_ALL="en_US.UTF-8"
[2]+  Done                    export LC_CTYPE="en_US.UTF-8"
Code language: Bash (bash)

First, you need to install locales package :

sudo apt-get install locales -yCode language: Bash (bash)

Then use the locale-gen command to generate locales :

sudo locale-gen en_US.UTF-8Code language: Bash (bash)

After that, permanently set the configuration to the system

sudo echo "LANG=en_US.UTF-8" > /etc/default/localeCode language: Bash (bash)

Just add these lines to your Dockerfile

Dockerfile#
Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
Code language: Dockerfile (dockerfile)

After setting the locale, verify that the system is updated by using the following command :

~$ locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"                                                                                                                                                            
LC_COLLATE="en_US.UTF-8"                                                                                                                                                         
LC_MONETARY="en_US.UTF-8"                                                                                                                                                        
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
Code language: Bash (bash)

Answer by Amaris Lozano

this means the environment variable LC_ALL is missing or invalid somehow.,LC_ALL is the environment variable that overrides the value of the LANG and the values of any other LC_* environment variables.,If you see the following error while installing pip:
,well explained.. it overrides all the other localisation settings.

Traceback (most recent call last):
     File "/usr/bin/pip", line 11, in <module>
       sys.exit(main())
     File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
       locale.setlocale(locale.LC_ALL, '')
     File "/usr/lib/python2.7/locale.py", line 581, in setlocale
       return _setlocale(category, locale)
   locale.Error: unsupported locale setting

Answer by Noor Correa

Ok, so I’ve just encountered the following error on my newly installed Ubuntu Machine: locale.Error: unsupported locale setting when I was trying create a virtual environment with python-virtualenv. After some googling i found the following solution:,Digital Designer, Backend and Frontend developer from Sweden with experience in usability.

Ok, so I’ve just encountered the following error on my newly installed Ubuntu Machine: locale.Error: unsupported locale setting when I was trying create a virtual environment with python-virtualenv. After some googling i found the following solution:

export LANGUAGE=en_US.UTF-8export LANG=en_US.UTF-8export LC_ALL=en_US.UTF-8locale-gen en_US.UTF-8sudo dpkg-reconfigure locales

Answer by Otis Bonilla

The reason is that the system lacks the corresponding language package, which needs to be downloaded and installed.,locale.Error: unsupported locale setting locale,Error: the solution set by unsupported locale
0. References 1. Cause of error 2. Solution,0. References
https://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting

1. Report the cause of the error
The ubuntu 16.04 installed on the vagrant + virtualbox installed on the ubuntu 16.04 used the pip3 list and the python3-m venv venv both commands gave the error message as follows:

[email protected]:~/microblog$ pip3 list
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python3.5/locale.py", line 594, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

2. Solutions
Use the locale locale to view the current language Settings:

[email protected]:~$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=

It is found that there are two languages in this setting, one is en_us.utf-8 , and the other is zh_cn.utf-8 .
Use locale -a to view all available languages in the current system:

[email protected]:~$ locale -a
C
C.UTF-8
en_US.utf8
id_ID.utf8
POSIX

It was found that zh_cn.utf-8 is missing in the available language above, and this is the reason for the error.
Use sudo apt install language-pack-zh-hans installation language:

[email protected]:~$ sudo apt install language-pack-zh-hans
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  language-pack-zh-hans-base
The following NEW packages will be installed:
  language-pack-zh-hans language-pack-zh-hans-base
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 2110 kB of archives.
After this operation, 8545 kB of additional disk space will be used.
Do you want to continue?[Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 language-pack-zh-hans-base all 1:16.04+20160627 [2108 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 language-pack-zh-hans all 1:16.04+20160627 [1870 B]
Fetched 2110 kB in 3s (567 kB/s)           
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "zh_CN.UTF-8",
    LC_MONETARY = "zh_CN.UTF-8",
    LC_ADDRESS = "zh_CN.UTF-8",
    LC_TELEPHONE = "zh_CN.UTF-8",
    LC_NAME = "zh_CN.UTF-8",
    LC_MEASUREMENT = "zh_CN.UTF-8",
    LC_IDENTIFICATION = "zh_CN.UTF-8",
    LC_NUMERIC = "zh_CN.UTF-8",
    LC_PAPER = "zh_CN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package language-pack-zh-hans-base.
(Reading database ... 89747 files and directories currently installed.)
Preparing to unpack .../language-pack-zh-hans-base_1%3a16.04+20160627_all.deb ...
Unpacking language-pack-zh-hans-base (1:16.04+20160627) ...
Selecting previously unselected package language-pack-zh-hans.
Preparing to unpack .../language-pack-zh-hans_1%3a16.04+20160627_all.deb ...
Unpacking language-pack-zh-hans (1:16.04+20160627) ...
Setting up language-pack-zh-hans (1:16.04+20160627) ...
Setting up language-pack-zh-hans-base (1:16.04+20160627) ...
Generating locales (this might take a while)...
  zh_CN.UTF-8... done
  zh_SG.UTF-8... done
Generation complete.

Answer by Drew Knight

Note that this function will not work with the ‘C’ locale, so you have to set a
locale via setlocale() first.,If the given encoding is not known, the function defaults to the default
encoding for the locale code just like setlocale().,The locale module defines the following exception and functions:,If locale is omitted or None, the current setting for category is
returned.

import locale
locale.setlocale(locale.LC_ALL, '')

Answer by Nathanael Velazquez

I’m new to python and getting this following error. FYI, I’m from India so, is there any issue in Indian Date Format?,Doing some testing now. Thanks for the logs @bobpullen,

Sorry, something went wrong.
,Try this simple python program, does it also give you an error:

import locale

locale.setlocale(locale.LC_ALL, 'en_GB')

  • Unreal gold не запускается на windows 10
  • Unsupported item key zabbix agent windows
  • Unsupported graphics card windows 10
  • Unknown lan id ewa windows 10
  • Unsecapp exe что это за процесс windows 7