[Pythonmac-SIG] unexpected behavior with $PYTHONHOME for Mach-O Python

Bob Savage bobsavage@mac.com
Mon, 04 Feb 2002 13:36:11 -0600


I don't understand something about mach-o Python.

If I don't have the $PYTHONHOME variable set, everything works properly,
----------------------------------------
[~/Desktop] bsavage % echo $PYTHONHOME
PYTHONHOME: Undefined variable.
[~/Desktop] bsavage % python
Python 2.2 (#1, Jan  9 2002, 15:28:46)
[GCC 2.95.2 19991024 (release)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'/Users/bsavage/Desktop'
>>> ^D

But if I set it, Python breaks!
----------------------------------------
[~/Desktop] bsavage % setenv PYTHONHOME
"/sw/lib/python2.2/:/sw/lib/python2.2/plat-darwin"
[~/Desktop] bsavage % python
'import site' failed; use -v for traceback
Python 2.2 (#1, Jan  9 2002, 15:28:46)
[GCC 2.95.2 19991024 (release)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named os
>>> ^D

Isn't this the opposite of what is supposed to happen?

Bob