[mod_python] pythonpath

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Mon Jan 31 10:22:57 EST 2005


Hi again,
I have done another test with the PythonPath directive, and the env variable 
is not set :
In index.py
#####################################
import os, sys
def index(req):
    path = os.environ['PATH']
    try:
        pythonpath = os.environ['PYTHONPATH']
    except:
        pythonpath = 'Not set'
    syspath =':'.join(sys.path)
  
    return('''<HTML><BODY>
            PATH = %s <BR>
            PYTHONPATH = %s <BR>
            SYSPATH = %s <BR></BODY></HTML>'''%(path, pythonpath, syspath))
#####################################
And the résult :
#####################################
PATH = /usr/local/bin:/usr/bin:/bin 
 PYTHONPATH = Not set 
 SYSPATH 
= /usr/lib/python23.zip:/usr/lib/python2.3:/usr/lib/python2.3/plat-linux2:/usr/lib/python2.3/lib-tk:
/usr/lib/python2.3/lib-dynload:/usr/local/lib/python2.3/site-packages:/usr/lib/python2.3/site-packages:
/usr/lib/python2.3/site-packages/Numeric:/usr/lib/python2.3/site-packages/PIL:
/topdir/webdir
#####################################


Le Lundi 31 Janvier 2005 15:12, Jorey Bump a écrit :
> Lionel Roubeyrie wrote:
> > Hi all,
> > I have a problem with the PYTHONPATH. I have to import in the web pages a
> > python module located in the topdirectory of where the web pages are
> > stored. For that I modify the PythonPath directive, but now Apache2 gives
> > a "Not Page Found" error, and I have to demand three or four times the
> > same url to finally have the web page. I also try without the PythonPath
> > directive and set it in the /etc/profile or in the .bashrc of the Apache
> > user, the same problem returns.
> > What can I do?
>
> You didn't provide enough details. Show us:
>
> 1. How you've configured mod_python (in httpd.conf or .htaccess)
> 2. How and where you've set the PYTHONPATH
> 3. The relevant parts of your importing module
> 4. The URL you are using
> 5. The relevant error entries in apache's error log
>
> Don't bother with /etc/profile or .bashrc. Also, include a function in
> your module to display the path, so you can confirm it's being set.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

-- 
Lionel Roubeyrie - lroubeyrie at limair.asso.fr
LIMAIR
http://www.limair.asso.fr




More information about the Mod_python mailing list