CGI Script using Python

Jeff jam at quark.emich.edu
Mon Jan 3 19:25:28 EST 2000


On Tue, Jan 04, 2000 at 12:20:51AM +0000, Paul E. Bible wrote:
> Hi there,
> 
> I'm currently developing a CGI script using Python under Apache Web Server.
> I've written a simple script, placed it in the /cgi-bin subdirectory and
> perform a chmod 755 on it.  Here is the script:
> 
> -----------------------------------------------------------
> #!/usr/local/bin/python
> import os, string, sys
> from cgi import *
> 
> def Main():
>     print "Content-type: text/html\n\n"
>     print "<HTML>"
>     print "<HEAD>"
>     print "This is a test"
>     print "</HEAD>"
>     print "<BODY></BODY>"
>     print "</HTML>"
>     sys.exit(0)
> 
> Main()

change the above to:

print "Content-Type: text/html"
print
print "<HTML>"
# continue with the rest of the script. notice extra 'print' above

hope that helps.

regards,
J
-- 
|| visit gfd <http://quark.emich.edu/>
|| psa member -- <http://www.python.org/psa/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




More information about the Python-list mailing list