How do I fix 'MySQLConverter' object has no attribute '_entry_to_mysql' for inventory input, python-mysql? How do I fix 'MySQLConverter' object has no attribute '_entry_to_mysql' for inventory input, python-mysql? tkinter tkinter

How do I fix 'MySQLConverter' object has no attribute '_entry_to_mysql' for inventory input, python-mysql?


You have to use parameter marks in your query or your database driver, in this case MySQL Connector/Python, will through an error. Also, you have to pass values which can be converted. MySQLConverter does not know how to convert entry-objects, so it tells you it can't convert it (although it can be a bit more explicit).

Here is an example (simplified):

s = ("INSERT INTO inventory (ID, Manufacturer, ItemName, PricePerItem, Quantity) "     "VALUES (%s, %s, %s, %s, %s) ON DUP..")cursor = cnx.cursor()cursor.execute(s, (ID.get(), Manufacturer.get(), ItemName.get(),                   PricePerItem.get(), Quantity.get()))

I took the liberty opening a bug report to improve the error message.

Other remark: I don't think you need to give the ID when inserting? Usually that is an AUTO_INCREMENT.