[Distutils] setuptools, PYTHONPATH and suExec

Joe Gregorio joe.gregorio at gmail.com
Wed Apr 26 21:39:22 CEST 2006


I recently installed 'paste' via setuptools to a local
directory. I don't have root on this system so I had to
use the --prefix option. From the command line
everything works fine:

  $ python
  Python 2.4 (#1, May 19 2005, 08:18:31)
  [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-49)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import paste
  >>>

But when I try to import paste from a .CGI script it fails.
The problem seems to be PYTHONPATH, or the lack-there-of.
I have a PYTHONPATH in my shell and that seems to
be the reason paste works from the shell. In the .CGI script
I don't have PYTHONPATH and the import of paste fails.

I tried manipulating sys.path at runtime from within the CGI,
but I believe that is too late
and by the time my script starts running the wrong (non-
PYTHONPATH) site.py has already been read. I tried
adding PYTHONPATH to the environment by
adding

  SetEnv PYTHONPATH  /blah

to the .htaccess, but I am running under suExec which appears to
only pass in white-listed environment variables.

Is there a way to get this to work or am I out of luck?

   Thanks,
   -joe

--
Joe Gregorio        http://bitworking.org


More information about the Distutils-SIG mailing list