Error: "unsupported Locale Setting" On Python / Osx
I've got the following error trying to run a local Python scriot on OSX Lion 10.7: You are using the base settings file. You are advised to create a local.py file (based on local_s
Solution 1:
This did the trick for me, write the one you want verbatim. I have 2 exception blocks because I use linux and osx:
Where in your code do you set it? This works for me, since the Linux and OSX machines vary and I use my code on both, I wrote this exception block:
try:
import locale
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
except Exception:
try:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
except Exception as e:
messages.error(request, 'An error occurred: {0}'.format(e))
My locale outputs:
locale
LANG="en_CA.UTF-8"
LC_COLLATE="en_CA.UTF-8"
LC_CTYPE="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_ALL=
Post a Comment for "Error: "unsupported Locale Setting" On Python / Osx"