CGIHTTPserver looze PYTHONPATH

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vincent delft

    CGIHTTPserver looze PYTHONPATH

    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
  • vincent_delft

    #2
    Re: CGIHTTPserver looze PYTHONPATH

    vincent delft wrote:

    I've found the problem by analysing the CGIHTTPServer.p y code.

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

    + os.execve(scrip tfile, args, os.environ)
    - os.execve(scrip tfile, args, env)






    [color=blue]
    > 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[/color]

    Comment

    Working...