title: ProgrammingError: Wrong number of arguments during string formatting
body: <p>I'm trying to put actively some datas from a list to my database in the table <code>polls_ip</code>. However it seems to be some problems of arguments maybe owing the type of the data I want to put inside.</p>
  
  <p>If you want to have a look of the usefull part of my code:</p>
  
  <pre><code>fin_flag = ( tcp.flags &amp; dpkt.tcp.TH_FIN ) != 0
  rst_flag = ( tcp.flags &amp; dpkt.tcp.TH_RST ) != 0
  
  if fin_flag or rst_flag:
      src_ip2 = socket.inet_ntoa(ip.src)
      dst_ip2 = socket.inet_ntoa(ip.dst)
      for element in liste:
          if element == (src_ip2+" "+dst_ip2) or element == (dst_ip2+" "+src_ip2):
              liste.remove(element)
  
              cursor.execute("INSERT INTO polls_ip (Ip) VALUES (%s)", (element))
  </code></pre>
  
  <p>The problem probably come from the line inside <code>cursor.execute</code>
  Have a look at the output:</p>
  
  <pre><code>Exception in thread Thread-1:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
      self.run()
    File "scriptbdd.py", line 134, in run
      self.p.dispatch(0, PieceRequestSniffer.cb)
    File "scriptbdd.py", line 120, in cb
      cursor.execute("INSERT INTO polls_ip (Ip) VALUES (%s)", (element))
    File "/usr/lib/pymodules/python2.7/mysql/connector/cursor.py", line 310, in execute
      "Wrong number of arguments during string formatting")
  ProgrammingError: Wrong number of arguments during string formatting
  </code></pre>
  
  <p>And even with a coma in <code>(element,))</code>, another problem is raised:</p>
  
  <pre><code>root@debian:/home/florian/Documents/mysite/polls# python scriptbdd.py 
  Exception in thread Thread-1:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
      self.run()
    File "scriptbdd.py", line 132, in run
      self.p.dispatch(0, PieceRequestSniffer.cb)
    File "scriptbdd.py", line 120, in cb
      cursor.execute("INSERT INTO polls_ip (Ip) VALUES (%s)", (element,))
    File "/usr/lib/pymodules/python2.7/mysql/connector/cursor.py", line 314, in execute
      res = self.db().protocol.cmd_query(stmt)
  InterfaceError: Failed executing the operation; 'NoneType' object has no attribute 'cmd_query'
  </code></pre>