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

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 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决
  • ¥15 关于华为5g模块mh5000-31接线问题
  • ¥15 keil L6007U报错
  • ¥15 webapi 发布到iis后无法访问
  • ¥15 初学者如何快速上手学习stm32?