[Tutor] Env Vars

Lloyd Kvam pythontutor@venix.com
Wed, 03 Jul 2002 15:29:54 -0400


Here's a short piece of code that should work!  Fix the
top line to match your system.

#!/usr/local/bin/python
import cgi
import os

http_req = cgi.FieldStorage()
print "Content-type: text/html"
print
try:
	import HTMLgen
	doc = HTMLgen.SimpleDocument()
	ostext = HTMLgen.Text( "The server is running %s" % os.name)
	doc.append(ostext)
	doc.write()
except ImportError:
	print "The server is running %s" % os.name


Kyle Babich wrote:

> My problem is this, I type #!/usr/bin/env python
> then what exactly do I put after that if I wanted to print, for example, the
> os type into the browser?
> 
> ----- Original Message -----
> From: "Lloyd Kvam" <lkvam@venix.com>
> To: "Kyle Babich" <kb@kb5.org>
> Sent: Wednesday, July 03, 2002 11:56 AM
> Subject: Re: [Tutor] Env Vars
> 
> 
> 
>>OK.  I have not kept that system properly patched so I don't like to
>>leave it exposed for too long.
>>
>>Let me (and the Tutor list) know if we can help.
>>
>>Kyle Babich wrote:
>>
>>
>>>Thank you, you can take it down.
>>>
>>
>>
>>
> 
> 
> 
> _______________________________________________
> 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