[Pythonmac-SIG] Python on OS X

Jack Jansen jack@oratrix.nl
Mon, 10 Dec 2001 11:44:32 +0100


> Below is the traceback with '-v' option on...
> 
> Could not find platform independent libraries <prefix>
> Could not find platform dependent libraries <exec_prefix>
> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

The problem lies earlier than what -v can find: Python can't find it's home 
folder, and therefore it can't set sys.path correctly. This usually means that 
Python has been moved, or that it has been installed in a different location 
than what it was built for. Try printing sys.prefix and sys.execprefix in your 
CGI script to see what they are. Then try whether you can access them from 
your CGI script. I.e. Add something like the following to your script (at the 
top):
import sys
print 'sys.prefix=', sys.prefix
print 'sys.exec_prefix=', sys.exec_prefix
print 'listdir(sys.prefix)=', posix.listdir(sys.prefix)
print 'listdir(sys.exec_prefix)=', posix.listdir(sys.exec_prefix)
print 'sys.path=', sys.path

One of the things I'm thinking of is that it could be that the webserver runs 
your script in a chroot()ed jail. This is a unix method to make sure that CGI 
scripts can never ever damage most of your system, by taking a subtree of the 
whole filesystem and calling that "/" for the CGI script.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm