Search code examples
pythonapachecginltkappdata

APPDATA is not returned in Python executed via CGI


I'm using Python with the NLTK toolkit in Apache via CGI. The toolkit need to know the APPDATA directory, but when executed in the server, the os.environ not lists theAPPDATA.

When I execute a simple print os.envrion in console, APPDATA is present, but not when executed via CGI in the web server.

What is going on? How can I solve this? I'm new to Python and I'm just learning it yet.


Solution

  • Is is quite possible. The CGI environment is different from the environment in the console.

    You can set the variable from Apache (from apache.conf):

    SetEnv APPDATA 1.2.3.4.5