How to set the locale?
Danilo Šegan
danilo at canonical.com
Mon Nov 21 07:53:20 UTC 2016
У нед, 20. 11 2016. у 21:47 -0600, Leo Arias пише:
>
> subprocess.check_call('export LANG=en_US.UTF-8', shell=True)
> subprocess.check_call('export LANGUAGE=en_US.UTF-8', shell=True)
> subprocess.check_call('export LC_ALL=en_US.UTF-8', shell=True)
> subprocess.check_call(['locale-gen', 'en_US.UTF-8'])
> subprocess.check_call(['dpkg-reconfigure', 'locales'])
os.environ["LC_ALL"] = "en_US.UTF-8"
should do what you want (after locale-gen, but en_US.UTF-8 is always
present on Ubuntu systems based on official images if I am not
mistaken; if not, use C.UTF-8 which is the name for "POSIX locale in
UTF-8").
You can always check what the locale is active by running "locale"
(just like that).
FWIW, calling out to locale.setlocale() will not help because that sets
the in-process locale, and will not apply to external programs.
Cheers,
Danilo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20161121/4717a822/attachment.html>
More information about the Juju
mailing list