500 Internal Server Error beim Ausführen eines CGI-Programms
Verfasst: Mittwoch 16. Mai 2012, 18:10
Hallo zusammen,
ich nutze einen Hosting-Dienst bei Celeros und habe kürzlich die folgenden code im Ordner /html/cgi-bin ausgeführt:
Dieser Code funktioniert einwandfrei und erzeugt folgende Ausgabe:
Nun habe ich ein etwas umfangreicheres Modul erstellt:
Der Code läuft auf meinem Windows Interpreter (V. 2.7.2) ohne Probleme. Es wird eine sqlite3-Datenbank erstellt und mit den Testdaten befüllt. Auf dem Server bekomme ich aber immer einen "500 Internal Server Error". Ich weiß nicht woran es liegt, die Datei ist nun als utf-8 abgespeichert und wurde mit Aptana Studio erstellt.
Kann mir hier jemand weiterhelfen? Ich weiß mir keinen Rat.
Danke,
Diddus
ich nutze einen Hosting-Dienst bei Celeros und habe kürzlich die folgenden code im Ordner /html/cgi-bin ausgeführt:
Code: Alles auswählen
#!/usr/bin/python
import sys
print "Content-type: text/html"
print ""
print sys.version_info
Code: Alles auswählen
sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0)
Code: Alles auswählen
#!/usr/bin/python
# database-functionality
import sqlite3
import cgitb
cgitb.enable()
# class DataBase
# management of any type of sqlite3-database
class DataBase:
def __init__(self, filePath="/data/database.dat"):
self.__connect = sqlite3.connect(filePath)
self.__cursor = self.__connect.cursor()
def __del__(self):
self.__connect.commit()
self.__cursor.close()
self.__cursor.close()
# add a new table
def addTable(self, name, format):
command = "CREATE TABLE "
command += (name + "(id")
for formatName in format:
command += ","
command += formatName
command += ")"
self.__cursor.execute(command)
self.__connect.commit()
# return whole table as list of tuples
def getTable(self, table):
pass
# delete whole table
def delTable(self, table):
self.__cursor.execute("DROP TABLE " + table)
self.__connect.commit()
# clear (delete all items) a table
def clearTable(self, table):
self.__cursor.execute("TRUNCATE TABLE " + table)
self.__connect.commit()
# add element in table
def addElement(self, table, element):
command = "INSERT INTO "
command += (table + " VALUES (?")
for i in range(len(element) - 1):
command += ",?"
command += ")"
self.__cursor.execute(command, element)
self.__connect.commit()
# get only one element by its ID
def getElementById(self, id):
pass
# delete element in table
def delElement(self, id):
pass
db = DataBase("database.dat")
db.addTable("personen", ("firstname", "lastname"))
db.addElement("personen", (1, "Martina", "Mueller"))
print("fertig")
Kann mir hier jemand weiterhelfen? Ich weiß mir keinen Rat.
Danke,
Diddus