Python 3 cgi script doesn't work, but python 2 works

I'm new to cgi programming :) I have the following python cgi-scripts, one in python2 and the other in python3. The servers works well with the python2 script but it doesn't run the python3 one. python3.2 is installed on the server.

Here is the python2 script:

#!/usr/bin/env python

print "Content-type: text/html"
print ""
print ''' 
<html>
<head>
<title>Hello Word - First CGI Program</title>
</head>
<body>
<h2>Hello Word! This is my first CGI program</h2>
</body>
</html>'''

Here is the python3 script

#!/usr/bin/env python3.2

print("Content-type: text/html")
print("")
print(''' 
<html>
<head>
<title>Hello Word - First CGI Program</title>
</head>
<body>
<h2>Hello Word! This is my first CGI program</h2>
</body>
</html>''')

Answers


The http.server is replaced. python3 -m http.server --cgi 8000


Need Your Help

Using DirectoryInfo in C#

c# text-files directoryinfo

If there a more efficient way to do the following:

How to get/find an object by property value in a list

c# linq

I have a question about getting a list objects by "searching" their field names using LINQ. I've coded simple Library and Book classes for this: