[Tutor] Env Vars

Kyle Babich Kyle Babich" <kb@kb5.org
Wed, 3 Jul 2002 01:14:58 +0000


I still am getting nothing, I'm probably doing it wrong.  Isn't there a
simple way of doing this?  I import os, then what to I type so I can
view it in the browser?  Can I get an example?  Thanks.

On Tue, 02 Jul 2002 19:56:35 -0400, "Lloyd Kvam"
<pythontutor@venix.com> said:
> I've been using HTMLgen where there are complications in the generated
> html.  To see the environment that your cgi script sees, simply run
> the cgi test function.  Here's one way to do it:
> 
> #cgitest.py
> import cgi
> cgi.test()
> 
> Install this into yor cgi-bin directory and use your browser to
> reference it, something like:
> 	webserver.com/cgi-bin/cgitest.py?var1=ABC&var2=DEF
> 
> You will get back a useful dump of the environment and the variables
> supplied to the script.
> 
> Kyle Babich wrote:
> 
> > Now I'm able to get it in the shell by importing os and then print
> > (os.environ['OSTYPE']) but I when I try to open it in the browser I
> > just get a blank page.
> > 
> > Also, so far my biggest problem with learning python has been the
> > text/html header.  What is the standard way of printing the text/html
> > header in python?
> > 
> > Thank you,
> > Kyle
> > 
> > On Tue, 2 Jul 2002 20:51:17 +0000, "Kyle Babich" <kb@kb5.org> said:
> > 
> >>How do I use it, find out what variables it includes?
> >>Also, how do I get raw_input to work in a browser?
> >>
> >>On Tue, 02 Jul 2002 14:43:37 -0400, "Lloyd Kvam"
> >><pythontutor@venix.com> said:
> >>
> >>>os.environ is a dictionary containing your environment names and
> >>>values.
> >>>
> >>>Also the cgi.test function will provide a great deal of information if
> >>>you are still working on cgi scripts.
> >>>
> >>>Kyle Babich wrote:
> >>>
> >>>
> >>>>How do environment variables work in python?  I couldn't seem to find
> >>>>documentation for this either.
> >>>>
> >>>>Thanks,
> >>>>Kyle
> >>>>
> >>>>
> >>>>_______________________________________________
> >>>>Tutor maillist  -  Tutor@python.org
> >>>>http://mail.python.org/mailman/listinfo/tutor
> >>>>
> >>>>
> >>>>
> >>>
> >>>-- 
> >>>Lloyd Kvam
> >>>Venix Corp.
> >>>1 Court Street, Suite 378
> >>>Lebanon, NH 03766-1358
> >>>
> >>>voice: 
> >>>603-443-6155
> >>>fax: 
> >>>801-459-9582
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>_______________________________________________
> >>Tutor maillist  -  Tutor@python.org
> >>http://mail.python.org/mailman/listinfo/tutor
> >>
> >>
> >>
> >>
> >>
> > 
> > 
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> > 
> > 
> 
> 
> -- 
> Lloyd Kvam
> Venix Corp.
> 1 Court Street, Suite 378
> Lebanon, NH 03766-1358
> 
> voice: 
> 603-443-6155
> fax: 
> 801-459-9582
> 
> 
> 
> 
>