nilamo
New Member
- Messages
- 2
- Reaction score
- 0
- Points
- 0
I'm currently learning python, and since cgi is a major part I thought I'd try to find an account where I could test a few things out and make sure they work. The following program was copied pretty much line by line from a book, and should show the current date and time in the browser window. To this end, I saved the file in the cgi-bin directory, changed the permissions to 755, and pointed my browser to http://nilamo.x10hosting.com/cgi-bin/time.py, and saw a 500 Internal Server Error. Is there a step I forgot? Any help would be greatly appreciated.
Code:
#!/usr/bin/python
import time
def printHeader(title):
print """Content-type: text/html
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head><title>%s</title></head>
<body>""" % title
printHeader("Current date and time")
print time.ctime(time.time() )
print "</body></html>"