I am trying to get Python working with IIS 7.5.
I have added a script handler for Python:
Python itself doesn't seem to be the problem. I have ran scripts on the command line with no problem. The script I am using to test Python functionality is below:
print
print 'HTTP/1.0 Status: 200 OK'
print 'Content-type: text/html'
print
print '<HTML><HEAD><TITLE>Python Sample CGI</TITLE></HEAD>'
print '<BODY>'
print '<H1>This is a header</H1>'
print '<p>' #this is a comment
print 'See this is just like most other HTML'
print '<br>'
print '</BODY>'
The problem is that IIS seems to be setting the HTTP content-type header to text/plain
before the python script is executed, because when I browse to the python script in my browser, I get this output:
What am I doing wrong, and how can I fix this?
Best Answer
There should be nothing at all printed before the header.
eg your program should start with: