Installation of Py3.0rc1 fails on Mac OS X with bad locale

M

Mario Ruggier

Hi,

i had the following problem when installing py3.0rc1 on a Mac OS X
10.5.5. On this system, the default locale values are:

$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

but "UTF-8" is is not a value for LC_CTYPE that is valid for python.
Proceeding with the above settings, doing configurie/make of py3.0rc1
fails:

$ cd Python-3.0rc1
$ ./configure
.... # seems to goes ok
$ make
.... # lots of omitted info output
ranlib: file: libpython3.0.a(pymath.o) has no symbols
gcc -o python.exe \
Modules/python.o \
libpython3.0.a -ldl
make: *** [sharedmods] Error 1

So, after some poking, I change the value of LC_CTYPE as follows:

$ LC_CTYPE=
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

And then redoing the configure/make/install steps seems to all go OK:

$ make clean
$ ./configure
$ make
$ make test
$ sudo make altinstall

$ python3.0 -c "import locale; print(locale.getdefaultlocale());"
(None, 'mac-roman')

Plus, running the newly installed python3.0 in the same terminal
window seems to be just fine. However, when I start a new terminal
(thus LC_CTYPE is back to its default value of "UTF-8") and run
python3.0 again, there are no errors but there is never any output!
For example:

$ python3.0 -c "import locale; print(locale.getdefaultlocale());"
$ python3.0
Python 3.0rc1 (r30rc1:66499, Oct 19 2008, 10:54:25)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
If I however re-unset LC_CTYPE, as above, then stdout to console seems
to work fine again. For completeness and curiosity, on the same system
py2.6 and py2.5 give the following locale info:

$ python2.6 -c "import locale; print locale.getdefaultlocale();"
(None, 'mac-roman')
$ python -c "import locale; print locale.getdefaultlocale();"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/locale.py", line 441, in getdefaultlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/locale.py", line 373, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

I think this issue is related to the (currently open) "Python fails
silently on bad locale" bug:
http://bugs.python.org/issue2173

How should this issue be worked around or dealt with? Should users on
Mac OS X 10.5 change the default value of LC_CTYPE? To what?

mario
 
M

Martin v. Löwis

How should this issue be worked around or dealt with? Should users on
Mac OS X 10.5 change the default value of LC_CTYPE? To what?

It would be best if a Mac user could propose a patch for that problem
before the release of Python 3.0.

Regards,
Martin
 
M

mr

It would be best if a Mac user could propose a patch for that problem
before the release of Python 3.0.

Not sure if this would qualify as a patch, but a workaround that seems
to be working for me is to change the bash environment's default
locale setting -- to a value acceptable to py3.

I did this by adding the following line to /etc/profile:

export LC_ALL="en_US.UTF-8"

Presumably, other valid values should also work correctly.

mario
 
M

Martin v. Löwis

Not sure if this would qualify as a patch, but a workaround that seems
to be working for me is to change the bash environment's default
locale setting -- to a value acceptable to py3.

I did this by adding the following line to /etc/profile:

export LC_ALL="en_US.UTF-8"

It's not a patch - as you say, it's a workaround. It's not clear to me
whether this has potentially negative side effects, such as other
programs now breaking.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top