CGIHTTPserver looze PYTHONPATH

Discussion in 'Python' started by vincent delft, Jul 13, 2003.

  1. 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, Jul 13, 2003
    #1
    1. Advertising

  2. 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)







    > 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, Jul 13, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Hansen

    Re: Securing PyDoc and CGIHTTPserver

    Peter Hansen, Jul 10, 2003, in forum: Python
    Replies:
    7
    Views:
    444
    Peter Hansen
    Jul 15, 2003
  2. Shane Hathaway

    Re: Securing PyDoc and CGIHTTPserver

    Shane Hathaway, Jul 10, 2003, in forum: Python
    Replies:
    1
    Views:
    383
    Shane Hathaway
    Jul 11, 2003
  3. Andy Worms

    CGIHTTPServer security Breach

    Andy Worms, Jul 22, 2003, in forum: Python
    Replies:
    0
    Views:
    378
    Andy Worms
    Jul 22, 2003
  4. vincent wehren
    Replies:
    3
    Views:
    414
    vincent wehren
    Nov 27, 2003
  5. William D. Gill

    using CGIHTTPserver to test html forms

    William D. Gill, Feb 23, 2004, in forum: Python
    Replies:
    3
    Views:
    4,994
    William D. Gill
    Feb 23, 2004
Loading...

Share This Page