title: Displaying database results in Python Flask: ValueError: dictionary update sequence element #0 has length 6; 2 is required
body: <p>How do I display the results of my database query out in CocoaRestClient using python flask?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>import json
  import sys
  import datetime
  import MySQLdb as mdb
  from flask import Flask, request, jsonify
  
  app = Flask(__name__)
  
  @app.route('/home')
  def hello_world():
      return "Welcome to Omnimoda."
  
  @app.route('/items/list')
  def get_items():
      #Change accordingly:
      #Connection Details:
      hostname = "localhost"
      username = "un"
      password = "pw"
      database = "db"
      q_list_one = "SELECT * FROM item_info"
      con = mdb.connect(hostname, username, password, database)
      cur = con.cursor()
      json_return = {}
      try:
          cur.execute(q_list_one)
          r_list_one = cur.fetchall()
      except Error as error:
          print(error)
      finally:
          cur.close()
          con.close()
  
      return jsonify(r_list_one)
  
  if __name__ == '__main__':
      app.run(host = '0.0.0.0', debug=True)
  </code></pre>
  
  <p>I got the <code>jsonify</code> bit from <a href="https://stackoverflow.com/questions/21709992/how-to-return-data-from-a-mysql-query-in-a-flask-app">here</a>, but all I'm getting is a <code>ValueError: dictionary update sequence element #0 has length 6; 2 is required</code><a href="http://pastebin.com/BYigDLXB" rel="nofollow noreferrer">(full error traceback here)</a></p>
  
  <p>Without the <code>jsonify</code>, I get a <code>TypeError: 'tuple' object is not callable</code>.</p>
  
  <p>Here's what the database looks like:</p>
  
  <p>Anything else I can try? Thanks.</p>
  
  <p><img src="https://i.stack.imgur.com/qazMy.png" alt="enter image description here"></p>