心云晓辉 2022-04-01 13:14 采纳率: 25%
浏览 228
已结题

python flask数据库查询报错。

学习python flask报错找不到原因,数据库查询出错。非常感谢!

img

img


builtins.TypeError
TypeError: 'float' object is not callable

Traceback (most recent call last)
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "X:\Python\Python39\Lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "X:\Python\Python39\Lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "X:\Python\Python39\Lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\python\Move\app\admin\views.py", line 15, in login
if form.validate_on_submit():
File "X:\Python\Python39\Lib\site-packages\flask_wtf\form.py", line 101, in validate_on_submit
return self.is_submitted() and self.validate()
File "X:\Python\Python39\Lib\site-packages\wtforms\form.py", line 310, in validate
return super(Form, self).validate(extra)
File "X:\Python\Python39\Lib\site-packages\wtforms\form.py", line 152, in validate
if not field.validate(self, extra):
File "X:\Python\Python39\Lib\site-packages\wtforms\fields\core.py", line 204, in validate
stop_validation = self._run_validation_chain(form, chain)
File "X:\Python\Python39\Lib\site-packages\wtforms\fields\core.py", line 224, in _run_validation_chain
validator(form, self)
File "C:\python\Move\app\admin\forms.py", line 46, in validate_account
admin = Admin.query.filter_by(name=account).count()
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 3113, in count
return self.from_self(col).scalar()
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2866, in scalar
ret = self.one()
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2837, in one
ret = self.one_or_none()
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2807, in one_or_none
ret = list(self)
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2878, in iter
return self._execute_and_instances(context)
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2901, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 948, in execute
return meth(self, multiparams, params)
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\sql\elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1055, in _execute_clauseelement
ret = self._execute_context(
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1147, in execute_context
fn(self, cursor, statement, parameters,
File "X:\Python\Python39\Lib\site-packages\sqlalchemy\events.py", line 624, in wrap_before_cursor_execute
orig_fn(conn, cursor, statement,
File "X:\Python\Python39\Lib\site-packages\flask_sqlalchemy_init
.py", line 252, in before_cursor_execute
context._query_start_time = _timer()
TypeError: 'float' object is not callable
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

  • 写回答

4条回答 默认 最新

  • sxn777 2022-04-02 11:20
    关注

    查看name的数据类型吧

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 4月16日
  • 已采纳回答 4月8日
  • 修改了问题 4月1日
  • 创建了问题 4月1日

悬赏问题

  • ¥15 conda 命令用不了 conda就是用不了 一用就显示core dumped
  • ¥100 基于delphi10.2几个功能的程序demo
  • ¥15 TinyMCE如何去掉自动弹出的“链接…”工具?
  • ¥15 微信支付转账凭证,如何解决
  • ¥15 在win10下使用指纹登录时,界面上的文字最后一个字产生换行现象
  • ¥20 使用AT89C51微控制器和MAX7219驱动器来实现0到99秒的秒表计数,有开始和暂停以及复位功能,下面有仿真图,请根据仿真图来设计c语言程序
  • ¥15 51单片机 双路ad同步采样
  • ¥15 使用xdocreport 生成word
  • ¥15 请教怎么用MATLAB求坐标
  • ¥15 gradle整合es,在创建索引时报错