problem adding custom module in cgi script

bobicanprogram icanbob at
Fri Dec 12 02:03:24 CET 2008


Apache server serving an HTML file to a Firefox Browser containing a
form and
a CGI python CGI script. HTML works fine, meat of the CGI script works
except that when a home grown and ordinarily functional module that is
to be
imported is added, the interpreter cannot find it.

Running cgi.test() reveals that PYTHONPATH is correctly set. Still
Adding the sys.* stuff still nada.

Items: Firefox Browser, Apache server, Python 2.5.


The CGI script:
#! /usr/bin/python

import cgi
import sys

#sys.path.insert(0, "/myModulePath")
import myModule **************** Problem here ********************

httpd error_log excerpt:
[Wed Dec 10 13:39:46 2008] [error] [client] Traceback
(most recent
call last):, referer:
[Wed Dec 10 13:39:46 2008] [error] [client]
File "/var/www/cgi-bin/", line 11, in <module>, referer:
[Wed Dec 10 13:39:46 2008] [error] [client]     import
[Wed Dec 10 13:39:46 2008] [error] [client] ImportError:
No module
named myModule, referer:

Relevant lines from http.conf:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
SetEnv PYTHONPATH /myModulePath

Thanks in advance for any pointers.


More information about the Python-list mailing list