py script web page problem ??

linux_on_wood aries at bitstream.net
Tue Apr 16 02:14:08 EDT 2002


Hey all,

ANY IDEAS, HELP , WHY  has a problem ???????????

I have tried this on (non-web server pc's)
my linux box and my win98 box both have python installed.
tried it with netscape 4.  and ms-IE 5.0
the book shows it should work

this html form renders properly and I dont have a 
problem with it...............but my python script
that gets called --friends1.py DOES NOT render the
html, it just shows the source code as text.
-------------------------------------

html and body tags and etc here........
<!-- form start -->
<a href="friends1.py">activate python script</a>

<FORM action="friends1.py" method=get>

<CENTER>

<p><p><br>
<!-- the radio's -->
<b>Enter your Name:</b>
<input type=text name=person size=20>
<p><br>
<input type=radio name=howmany value="10">10
    
<input type=radio name=howmany value="20" checked>20
    
<input type=radio name=howmany value="30">30
    
<!--submitbelow-->
<BR><p><BR><FONT color=red>Look over the checkboxes, if everything looks
ok then click the Query button.</FONT>
<INPUT type=submit value="Go HTML Python script">

--------------------------------------------------------



my python script code is:    friends1.py  as chmod 755 on linux box

#! /usr/bin/env python
# program to process html form
# by Joseph Franzmeier Apr 14 2002

import cgi

reshtml = '''Content-Type: text/html\n
<html><head><title>
The Friends Python CGI Demo (dynamic screen) !!
</title></head>
<body><h3>Friends list ofyour name is: <i>%s</i></h3>
Your name is: <b>%s </b><p>
The number of friends you have is: <b>%s</b> total
</body></html>'''

form = cgi.FieldStorage()
who = form['person'].value
howmany = form['howmany'].value
print reshtml % (who, who, howmany)

#print_environ_usage()

--------------------------------------------------

This script code looks very correct to me but it
gets called --friends1.py DOES NOT render the
html, it just shows the source code as text.

ANY IDEAS, HELP , WHY  has a problem ???????????

Thanks,
Joe F.



More information about the Python-list mailing list