[Tutor] CGI output when reading HTML file

Sharriff Aina NHYTRO@compuserve.com
Tue, 30 Jan 2001 02:42:49 -0500


Hi guys!

I=B4m creating HTML from an online HTML editor, my CGI script saves the H=
TML
code to a directory on the Server. My problem is, I can=B4t get my CGI co=
de
to read and then send (print) the HTML to the client.

My code:

#!C:/Python/python.exe -u

print "Content-Type: text/html\n\n"

import cgi
import webbrowser
#
#
form =3D cgi.FieldStorage()
print "saving html to file..."
htmlfile =3D open("./webpages/tester.html", "w")
htmlfile.write(form["editarea"].value)
#test =3D htmlfile.readlines()
#print test  does not print HTML to client!!
print "test file output..."
# the below line just display the HTML on the WEBserver machine, not the
client
webbrowser.open("./webpages/tester.html")

I=B4d really appreciate any ideas as to going about this


Regards

Sharriff