学习python flask报错找不到原因,数据库查询出错。非常感谢!
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