How to import modules in cgi applications?

Gillou nospam at bigfoot.com
Wed Dec 19 12:50:19 EST 2001


1/ Look at your web server log file or error file to see the python
traceback
2/ Try this simple CGI script:

import cgi
cgi.test()

And look if you already got the PYTHONPATH environment variable in the CGI
process.
If not, look at your web server doc for setting/passing environment
variables to the CGI scripts
If U use Apache, take a look at this...

http://httpd.apache.org/docs-2.0/mod/mod_env.html

You're 2 or 3 Apache directives away from the solution...

HTH

--Gillou

"Daniel" <dlrubinUN-SPAM at yahoo.com> a écrit dans le message news:
3C20C6F2.7CE2A7B3 at yahoo.com...
> Hi,
> I'm writing a cgi script that uses a package I installed into Python
> called DCOralce2.
> My cgi script (test.py) causes an internal server error if it's run from
> a web browser, but not if I run it from the command line--the problem
> must be finding the module when the python script is run from the web
> client. I tried writing a shell script to set PYTHONPATH and then
> calling my cgi:
>
> #!/bin/sh
> PYTHONPATH="/home/rb/lib/pylib"
> export PYTHONPATH
> ./test.py
>
> where the PYTHONPATH is the path to where DCOralce2 lives, and it's the
> same as the one used in my environment. But this still doesn't work. Any
> suggestions?
>
> Thanks,
> Daniel
>
> --
> To reply to me directly, please remove "UNSPAM" from my email address
>
>





More information about the Python-list mailing list