Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 sqlite3.OperationalError: near "%": syntax error
#1
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()
Error:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Gaming\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File "C:/Film-Classic-Database/film1.py", line 147, in add_film self.Rating_var.get())) sqlite3.OperationalError: near "%": syntax error
Quote
#2
I see a missing paren to close out c.execute. Other than that, everything looks syntactically correct.
Quote
#3
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.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  kivy - packaging touchtracer syntax error cram 2 75 Oct-14-2019, 08:30 PM
Last Post: cram
  def Display Data Invalid Syntax error Linuxdesire 1 82 Oct-11-2019, 05:10 AM
Last Post: stranac
  Invalid Syntax error mustfirst 8 138 Oct-07-2019, 06:39 PM
Last Post: buran
  Syntax Error with Argument Parser aditya_man 1 87 Sep-30-2019, 01:21 PM
Last Post: ichabod801
  Need help with "unexpected expression syntax error" PyCoder 2 111 Sep-29-2019, 05:42 AM
Last Post: PyCoder
  Error Syntax -HackerRank challenge RavCOder 9 256 Sep-20-2019, 02:57 PM
Last Post: perfringo
Exclamation Get syntax error. Dont understand why beLIEve 21 1,127 Aug-25-2019, 02:28 PM
Last Post: ThomasL
  Syntax error for a reason I don't understand DanielCook 2 168 Aug-07-2019, 11:49 AM
Last Post: buran
  [split] Python beginner: Weird Syntax Error mnsaathvika 1 193 Jul-22-2019, 06:14 AM
Last Post: buran
  While True is a syntax error? Piethon 8 410 Jul-21-2019, 12:40 PM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)