CGI module problem: duplicated output

Mimal mi-mal at o2.pl
Fri Jan 9 09:19:51 EST 2004


Hello,
     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:

#!/usr/bin/python
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!

-- 
Mimal






More information about the Python-list mailing list