CGI module problem: duplicated output

Mimal mi-mal at
Fri Jan 9 15:19:51 CET 2004

     I started to learn how to use python with CGI. I went through some 
tutorials, but then I found one problem, that seems to be something 
stupid. I tried to find answer using google, but I couldn't.

This is my simple CGI script:

import cgi

print "Content-type: text/html\n"
print "<html>Hello, world!</html>"

After I run it under Apache I got (HTML source code):

Hello, world!Content-type: text/html Hello, world!

I tried to run it under bash console. I got this:

<html>Hello, world!</html>
Content-type: text/html

<html>Hello, world!</html>

That's very strange for me. I'm using Mandrake 9.2 + Apache 2 + Python 
2.3, but the same problem occurs under WinNT + Python 2.1 and WinXP + 
Zope + Python 2.3.

Thanks in advance for help!


More information about the Python-list mailing list