[Pythonmac-SIG] newbie questions: import site failed and proper location of site-packages
Hunt Culver
hculver at cfl.rr.com
Wed Nov 5 03:08:18 CET 2008
I was trying to put my own .py modules in the site-packages folder but
they were loading as expected, so I searched various threads and
discovered there are many possible site-package directories on a Mac
OS 10.5 system.
Then after more troubleshoot I discovered that import site was not
working.
So I removed MacPython entirely and started over using the
instructions for Python 2.5 for OS X at
http://www.python.org/download/mac/
Using the traceback option as mentioned in a july 2005 thread this is
a part of the diagnostics I got in terminal when I executed python -v.
'import site' failed; traceback:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.py", line 417, in <module>
main()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.py", line 402, in main
paths_in_sys = addsitepackages(paths_in_sys)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.py", line 208, in addsitepackages
addsitedir(sitedir, known_paths)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.py", line 169, in addsitedir
addpackage(sitedir, name, known_paths)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.py", line 142, in addpackage
if not dircase in known_paths and os.path.exists(dir):
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/posixpath.py", line 171, in exists
st = os.stat(path)
TypeError: stat() argument 1 must be (encoded string without NULL
bytes), not str
This is a new install, so any ideas what may be the cause and how to
fix this?
And back to the original question; which site-package directory works
with MacPython 2.5?
Thanks,
Hunt
More information about the Pythonmac-SIG
mailing list