sqlite3.OperationalError: near "%": syntax error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: sqlite3.OperationalError: near "%": syntax error (/thread-21752.html) |
sqlite3.OperationalError: near "%": syntax error - Linuxdesire - Oct-12-2019 I am getting an error trying to connect to my SQLite database. I have tried several things and it is not working. I cannot figure out where the syntax error is, near self.Rating_var.get())) #=======CONNECT TO SQLITE========== def add_film(self): conn = connect('patrick.db') c = conn.cursor() c.execute("insert into patrick values(%s,%s,%s,%s,%s,%s,%s,%s)",(self.Title_var.get(), self.Actors_var.get(), self.Directors_var.get(), self.Genre_var.get(), self.Summary_var.get(), self.Year_var.get(), self.Length_var.get(), self.Rating_var.get()) con.commit() con.close()
RE: sqlite3.OperationalError: near "%": syntax error - stullis - Oct-13-2019 I see a missing paren to close out c.execute. Other than that, everything looks syntactically correct. RE: sqlite3.OperationalError: near "%": syntax error - Linuxdesire - Oct-13-2019 Thank you. Yes, I added that parenthesis but still cannot figure out why it is not writing to my database when I click on add. It just gives me that error. Thank you for your help. |