title: Flask, not all arguments converted during string formatting
body: <p>Try to create a register page for my app. I am using Flask framework and MySQL db from <a href="https://www.pythonanywhere.com" rel="nofollow">pythonanywhere.com</a>. </p>
  
  <pre><code>@app.route('/register/', methods=["GET","POST"]) 
  def register_page():
  try:
      form = RegistrationForm(request.form)
  
  
  
      if request.method == "POST" and form.validate():
          email = form.email.data
          password = sha256_crypt.encrypt((str(form.password.data)))
          c, conn = connection()
  
          x = c.execute("SELECT * FROM users WHERE email = (%s)",
                        (email))
  
          if int(x) &gt; 0:
              flash("That email adress is already in use.")
              return render_template('register.html', form=form)
  
          else:
              c.execute("INSERT INTO users (email, password) VALUES (%s, %s)",
                        (thwart(email),thwart(password)))
  
              conn.commit()
              flash("Thanks for registering!")
              c.close()
              conn.close()
              gc.collect()
  
              session['logged_in'] = True
              session['email'] = email
  
              return redirect(url_for('dashboard'))
  
      return render_template("sign-up.html", form=form)
  
  
  except Exception as e:
      return(str(e))}
  </code></pre>
  
  <p>On running I get the Error:not all arguments converted during string formatting.
  How to fix it? May be the problem in this statement? </p>
  
  <p><code>c.execute("INSERT INTO users (email, password) VALUES (%s, %s)",
                            (thwart(email),thwart(password)))</code></p>