Python CGI programming

Chris Gonnerman chris.gonnerman at
Fri Feb 2 00:01:39 EST 2001

----- Original Message -----
From: "seung-won hwang" <shwang5 at>
Subject: Re: Python CGI programming

> FYI, when I type the following example, web browser just shows
> the source code..not the test string... How can I fix this?
> #!/usr/bin/python
> # Tell the browser how to render the text
> print "Content-Type: text/plain\n\n"
> print "Hello, Python!"  # print a test string

The webserver does not recognize your script as a cgi script.  Depending on
the webserver,
you may be required to put the script in a special subdirectory (cgi-bin or
scripts for instance), make registry or config file changes on the server
(unlikely to be allowed if you don't own the server yourself), etc.

The 405 error you are getting is because METHOD=POST is not allowed for
non-cgi documents by your webserver, and as I said, it doesn't know it is a
cgi script.

Can you tell us anything else about your problem?  (What host OS/webserver,
do you have root or administrative access, etc.)?

More information about the Python-list mailing list