print(command) cursor.execute(command) db.commit cursor.close() db.close()
Can you give us some example output from the print(command)
trace code? It could be as simple as a missing quote or an improper tablename. Also, where is tablename even coming from? I don't see it in your code anywhere.