Can't get a simple CGI script to print HTML - what am I doing wrong??

Randy Burgess rburgess1 at hvc.rr.com
Tue Dec 17 17:05:09 EST 2002


Hi all,

I'm trying to develop some simple Python scripts to run on my web site at
http://usable-thought.com. However my testing is running into major
problems!

My hosting service, hostway.com, runs Python 1.5.1 on the server, which is
Unix-based and I'm assuming is probably Apache. I can get some crude test
scripts to work - for example, I can import cgi and run cgi.test() - but I
can't get some other, equally crude scripts to print basic HTML. They run
fine off the command line when I'm in a SSH session, but when I try to
access them via browser, I get an "internal server error." I have made sure
file permissions are OK, but this doesn't help. I'm pretty sure the path
name to Python is correct, since it works for the cgi import.

Here's an example of a script that utterly refuses to work:

#!/usr/bin/env python
print "Content-type: text/html"
print
print "<H3>What follows is a test.</H3>"

What could be simpler? Yet I can't get it to print html in the browser -
just that frustrating "internal server error." I have gone through the
documentation for Python 1.5.1, including the page on debugging CGI
scripts - http://www.python.org/doc/1.5.1p1/lib/node168.html - but am making
no headway.

Is there something simple I am overlooking?!?

thanks for any help,
Randy Burgess

-----------------------------------------------------------
Randy Burgess
Usable Thought
http://usable-thought.com
Copywriting, information design, and creative direction
914-466-6810
"Marketing writing that illuminates IT from the inside."
-----------------------------------------------------------






More information about the Python-list mailing list