CGIHTTPserver looze PYTHONPATH

V

vincent delft

I'm using Python 2.2.2
the standard cgihttpserver (example given in the python doc).
All HTML and CGI work.

BUT

by writing a simple python-cgi script like this :
"
#!/usr/bin/env python
import os
print "<html>%s</html>" % os.environ
"
I've discover that the environement variable are lost.
For example PYTHONPATH is no more present.

Can you explain me why ?
Does this is a bug ?
How can I keep my PYTHONPATH variable across my python-cgi ?
(I don't want to add os.putenv on top of each python-cgi script)

Thanks
 
V

vincent_delft

vincent delft wrote:

I've found the problem by analysing the CGIHTTPServer.py code.

The exec command send the LOCAL env variable instead of the full
environemnts.

+ os.execve(scriptfile, args, os.environ)
- os.execve(scriptfile, args, env)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,797
Messages
2,569,647
Members
45,377
Latest member
Zebacus

Latest Threads

Top