Note on mac osx 10.6 installation - locale

574 views
Skip to first unread message

Petrush

unread,
Mar 12, 2011, 10:11:41 AM3/12/11
to spyder
I have finally got spyder to work on mac osx 10.6. Initially I had big
difficulties to get PyQt4 to work, but after a complete removal and
compilation with i386 (i'm running 32-bit python) that works.

There is a bug in python/mac/something that makes
locale.getdefaultlocale() to fail (at least with swedish locale), so I
needed to set the environment variables in .profile manually:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8


Pierre Raybaut

unread,
Mar 13, 2011, 5:20:45 AM3/13/11
to spyder
Hi,

Thanks for your feedback.

Indeed this locale-related error is not due to Spyder but to MacOS
itself.
Apparently, MacOS -which is a UNIX-like operating system- is using an
invalid LANG (or LC_ALL or LC_CTYPE) environment variable. "UTF-8"
alone is not valid. On the contrary, "en_US.UTF-8" is a correct value
(like "en_GB.UTF-8" for GB, "fr_FR.UTF-8" for France, "es_ES.UTF-8"
for Spain, and so on).

So to fix this, I see two options (I'm not a Mac user I haven't tested
any of this):
1. the solution suggested by Petrush, i.e. adding manually the
environment variables corresponding to your language
2. maybe (again, I did not have the opportunity to test it) unchecking
the "Set LANG environment variable on startup" checkbox in the
Terminal settings, under the "Advanced" tab would fix this too (see
here: http://henrik.nyh.se/2007/10/displaying-utf-8-correctly-in-leopard-terminal).

Anyway, I think this not appropriate to include a patch for this in
Spyder as you would encounter this issue outside Spyder too.

Cheers,
Pierre
Reply all
Reply to author
Forward
0 new messages