Lionel Roubeyrie
lroubeyrie at limair.asso.fr
Mon Jan 31 09:57:40 EST 2005
Hi, Le Lundi 31 Janvier 2005 15:12, Jorey Bump a écrit : > You didn't provide enough details. Show us: > > 1. How you've configured mod_python (in httpd.conf or .htaccess) in httpd.conf of Apache2: Alias /cartairweb /topdir/webdir Directory /topdir/webdir> Order allow,deny Allow from all Options Indexes Includes FollowSymLinks MultiViews AddHandler mod_python .py PythonHandler mod_python.publisher # PythonPath "sys.path+['/topdir']" PythonDebug On </Directory> > 2. How and where you've set the PYTHONPATH Like in the previous lines, or using a more Goliath' like method calling setEnviron() : #################################### def getParentDir(): currentfile = os.path.abspath(__file__) currentdir = os.path.split(currentfile)[0] parentdir = os.path.split(currentdir)[0] return parentdir def setEnviron(): parentdir = getParentDir() if parentdir not in sys.path : sys.path.append(parentdir) os.environ['PYTHONPATH']=parentdir #################################### In all case, I have to change the current working directory to where the web pages are. > 3. The relevant parts of your importing module In fact, the error comes when I import the desired module (cartair) located in the topdirectory: #################################### import os, utils import cartair utils.setCurrentWkDir() utils.setEnviron() def index(req, executer='0', section='PREVAIR', date_calcul='', date_prevu='', code_modele='', polluant='', niveau='', squelette=''): result = '' conf= cartair.CartairConf() date = cartair.Cdate() try: if (code_modele == '') or (code_modele == None): code_modele=conf.get(section, 'code_modele') ... #################################### > 4. The URL you are using http://localhost/cartairweb/ > 5. The relevant error entries in apache's error log no real error > 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. Sometimes yes, sometimes no ... > 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
|