main.py当我在路线之外使用cursor.execute..时,它正在工作。import mysql.connectorfrom flask import Flask, render_template, request, session, redirect, url_for, make_responseMySQL = mysql.connector.connect( user='root', password='password', host='localhost', database='dbname', use_pure=True)cursor = MySQL.cursor(prepared=True)@app.route("/bridge", methods=["POST"])def bridge(): if request.get_json()["for"] == "signUp": if request.get_json()["type"] == "existence": cursor.execute("SELECT id FROM users WHERE eMail=%s", (request.get_json()["details"]["eMail"], )) print("----------------- {}".format(cursor.fetchone())) print(request.get_json()["details"]["eMail"]) return make_response(json.dumps({"Res"}), 200)cursor.close()MySQL.close()错误cursor.execute("从电子邮件中选择 id=%s", (request.get_json()["details"]["eMail"], )) 文件 "C:\Users\woxro\AppData\Local\Programs\ Python\Python38-32\Lib\site-packages\mysql\connector\cursor.py”,第 1186 行,执行 charset = self._connection.charset AttributeError: 'NoneType' 对象没有属性 'charset'
添加回答
举报
0/150
提交
取消