module import in cgi scripts

Dag Dag at animagicnet.no
Wed Mar 13 06:22:08 EST 2002


I'm trying to write a cgi script in python but I'm having a lot of
problems importing modules.

I've simplified my script down to
#!/usr/bin/python2.2
import pg
print "hello\n"

if I run it from the command line it prints "hello" as expected,
but if I put it in my cgi-bin directory and access it from a web
browser the web server returns Internal Server Error and the 
error log says:
Traceback (most recent call last):
  File "/var/www/cgi-bin/summarypie.py", line 4, in ?
    import pg
ImportError: No module named pg

I have checked and double checked and the pg modules is in the
python sys.path.  What's wrong?

I'm running this on Apache 1.2.23 on linux.

Dag



More information about the Python-list mailing list