Connect MySQl with Python Error : function 'inet_pton' not found -
import mysql.connector cnx = mysql.connector.connect(user=user, password=password,host=host,database=database) cursor = cnx.cursor() add_employee = ("insert 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 tbl_device 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 debug next error:
attributeerror: function 'inet_pton' not found
what wrong code?please help prepare it,thanks much ! connector downlaoded mysql official web site, , m using python 3.3 have found in google, mysql bug?because m using window xp. http://bugs.mysql.com/bug.php?id=68065
problem solved after download connector http://pypi.python.org/pypi/mysql-connector-python, mysql official web's connector can't use
python mysql sql database
No comments:
Post a Comment