'sqlite3.Cursor' object has no attribute '__getitem__' Error in Python Flask
<p>This is my code. I get this error everytime I press login:</p>

<p><strong>'sqlite3.Cursor' object has no attribute '__getitem__'</strong></p>

<p>This is my login tab:</p>

<pre><code>@app.route('/', methods=['GET', 'POST'])
def login():
    error= None
    if request.method == "POST":
        with sql.connect("database.db") as con:
            cur = con.cursor()
            try:
                data = cur.execute("SELECT name FROM users WHERE name= ?",(request.form['username'],) )
                data.fetchone()

                if sha256_crypt.verify(request.form['password'], data[0]):
                    session['logged_in'] == True
                    session['username'] = request.form('username')
                    flash('Successfully logged in')
                    return redirect(url_for(hello_world))
                else:
                    error = "Invalid Password or User. Try again."

            except Exception as e:
                flash(e)
                return render_template('login.html',error=error)
        con.close()
        gc.collect()
    return render_template('login.html', error=error)
</code></pre>

<p>What I am doing wrong?</p>