Help setting CGI Environment Variables

Ari David Greenberg arigreen at stanford.edu
Sat May 26 23:12:15 EDT 2001


I am trying to write a CGI script that must modify some CGI environment
variables. How should I do this? I tried the following:

#!/usr/pubsw/bin/python
import sys, os
os.putenv("TEST_VAR", "/abc")

for name, value in os.environ.items():
	print "%s\t= %s" % (name, value)


I ran this program from the command prompt, and it printed all my
environment variables however it did not print TEST_VAR. I am concerned
that I am not setting TEST_VAR properly. I thought os.putenv(<name>,
<value>) was the way to do it, but I'm having difficulties.

Any help greatly appreciated. Please email me.

-Ari




More information about the Python-list mailing list