[Tutor] sys.path.append issues with cgi

Gabriel Farrell gsf at panix.com
Fri Apr 15 00:43:26 CEST 2005


Hello all,

I'm trying to modify the sys.path in my cgi scripts to import modules
that I've installed in my home directory.  The top of the script reads
as follows:


#!/usr/local/bin/python

import cgi, sys
sys.path.append('/net/u/16/g/gsf/lib/python2.4/site-packages')
from ElementTree import Element, SubElement, tostring


But my traceback reads:

ImportError: No module named ElementTree


The appended path is the same I've added to my PYTHONPATH variable and
it works fine from the python interactive prompt.  I thought it might
be a permissions issue since it's a cgi script so I chmodded
everything up to the ElementTree directory 755 but still no luck.

TIA,
gabe


More information about the Tutor mailing list