FAQ
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 >
<p><br>
<input type=radio name=howmany value="10">10
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=radio name=howmany value="20" checked>20
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=radio name=howmany value="30">30
&nbsp;&nbsp;&nbsp;&nbsp;
<!--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.

Search Discussions

  • Oleg Broytmann at Apr 16, 2002 at 7:54 am

    On Mon, Apr 15, 2002 at 11:14:08PM -0700, linux_on_wood wrote:
    <FORM action="friends1.py" method=get>

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

    #! /usr/bin/env python

    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.
    A script (any script) should not "rebder" HTML - it will just pass the
    HTML back to a browser. Do I understand your question right that instead of
    HTML you get the source code of the script?
    ANY IDEAS, HELP , WHY has a problem ???????????
    It seems your web-server was not configured to recognize .py extension
    as a CGI extension. Reconfigure your server.

    Oleg.
    --
    Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
    Programmers don't die, they just GOSUB without RETURN.
  • Ian Parker at Apr 17, 2002 at 10:29 pm
    In article <mailman.1018944513.17890.python-list at python.org>, Oleg
    Broytmann <phd at phd.pp.ru> writes
    On Mon, Apr 15, 2002 at 11:14:08PM -0700, linux_on_wood wrote:
    <FORM action="friends1.py" method=get>

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

    #! /usr/bin/env python

    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.
    A script (any script) should not "rebder" HTML - it will just pass the
    HTML back to a browser. Do I understand your question right that instead of
    HTML you get the source code of the script?
    ANY IDEAS, HELP , WHY has a problem ???????????
    It seems your web-server was not configured to recognize .py extension
    as a CGI extension. Reconfigure your server.

    Oleg.
    Or that the web-server doesn't recognise scripts in this directory as
    being executable.

    Regards
    --
    Ian Parker

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 16, '02 at 6:14a
activeApr 17, '02 at 10:29p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase