import mysql.connector
cnx = mysql.connector.connect(user=user, password=password,host=host,database=database)
cursor = cnx.cursor()
add_employee = ("INSERT INTO tbl_gps "
"(Locating, MainPower, Acc, PowerOff, Alarm,Speed,Direction,Latitude,Longitude,DateTime,IOState,OilState,MainID) "
"VALUES (%s, %s, %s, %s, %s,% s, %s, %s, %s, %s, %s, %s, (SELECT MainID From tbl_device WHERE DeviceID = %s))")
data_employee = {
'Locating': 1,
'MainPower': 1,
'Acc': 1,
'PowerOff': 1,
'Alarm': 0x80,
'Speed': 1,
'Direction': 300,
'Latitude': 10.00,
'Longtitude': -20.00,
'DateTime': '2013/2/8 01:00:00',
'IOState': 0,
'OilState': 0,
'MainID': 'NR09533'
}
cursor.execute(add_employee, data_employee)
cnx.close()
when i debug get the following error:
AttributeError: function 'inet_pton' not found
what wrong with my code?please help to fix it,thanks you very much !
the connector are downlaoded from Mysql official web site,
and i m using Python 3.3
i have found this in google, this is a Mysql Bug?because i m using Window XP.
http://bugs.mysql.com/bug.php?id=68065
Problem Solved after i download the Connector from http://pypi.python.org/pypi/mysql-connector-python, the mysql official web’s connector can’t use