ich habe folgendes Problem, beim Aufruf meiner Klasse bekomme ich folgende Fehlermeldung:
Traceback (most recent call last):
File "E:\Python\mysql.py", line 119, in -toplevel-
status = test.MySQLdbAddLog("lnfdgkjghn")
File "E:\Python\mysql.py", line 103, in MySQLdbAddLog
self.db.query(sql)
ProgrammingError: (1146, "Table 'test.t_log' doesn't exist")
Der Ausschnitt des Quellcodes sieht wie folgt aus:
Code: Alles auswählen
class MyMySQLdb:
def __init__(self):
#self.db = MySQLdb.connect(host="192.168.0.3",user="openEMS", passwd="openEMS",db="openEMS")
self.db = MySQLdb.connect(host="192.168.25.171",user="test", passwd="test",db="test")
def MySQLdbAddLog(self, text):
#Baue Datum und Uhrzeit zusammen
datumAll = time.strftime('%X %x')
datum = datumAll[12:14] + "." + datumAll[9:11] + "." + datumAll[15:17]
timeAll = time.strftime('%H %M')
zeit = timeAll[0:2] + "." + timeAll[3:5]
sql1 = "INSERT INTO t_log (text, datum, zeit) VALUES"
sql2= "('" + text + "', '" + datum + "', '" + zeit + "')"
sql = sql1 + sql2
self.db.query(sql)
#return 13
test = MyMySQLdb()
status = test.MySQLdbAddLog("lnfdgkjghn")
print status
Mich iritiert in der Fehlermeldung, warum steht da "Table 'test.t_log' doesn't exist" ?
Michael