Have I broken my installation?
Erik Max Francis
max at alcyone.com
Sat Jun 28 17:18:11 EDT 2003
Matt Mower wrote:
> I made one small adjustment, specifying the --prefix=/opt/python
> option to put PyXML in the same directory as Python 2.2.
Well, that's your problem right there. Note the symptomology of what
Martin von Loewis asked you to test -- it prints different things for
your interactive usage and the CGI script.
> My entire Python developing experience runs to about an afternoons
> worth so I have no idea why PyXML isn't working or isn't being found.
That's because the problem you're running into here is a difference in
environment between you running the program in your interactive shell
and Apache running it as nobody. It's a general Unix issue, not
specific to Python.
> Can you suggest anything?
The problem is that you've installed PyXML in /opt/python, which is a
nonstandard place -- though that isn't in and of itself wrong if you
know what you're doing. You've obviously adjusted your interactive
environment to look in /opt/python, since you're running the scripts
without problems locally, but CGI scripts do not run in your
environment, and so aren't seeing what you've installed in /opt/python,
since that is a nonstandard place. For a quick remedy, add something
like this:
import sys
sys.path.append('/opt/python')
to the top of your script. A more permanent solution would involve
adding it to /usr/local/lib/pythonX.Y/site.py.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Every astronaut who goes up knows the risks he or she faces.
\__/ Sally Ride
More information about the Python-list
mailing list