TypeError: 'User' is an invalid keyword argument for this function

来源:7-3 登录退出(1)

纪文

2020-03-28

一直是这个问题卡着我,之前快速生成 ORM model也是这种情况,这次也是,课程已经看到后面一部分了,但这个问题解决不了,项目也运行不下去

TypeError: ‘User’ is an invalid keyword argument for this function

Traceback (most recent call last)
File “F:\python\lib\site-packages\flask\app.py”, line 2463, in call
return self.wsgi_app(environ, start_response)
File “F:\python\lib\site-packages\flask\app.py”, line 2449, in wsgi_app
response = self.handle_exception(e)
File “F:\python\lib\site-packages\flask\app.py”, line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File “F:\python\lib\site-packages\flask_compat.py”, line 39, in reraise
raise value
File “F:\python\lib\site-packages\flask\app.py”, line 2446, in wsgi_app
response = self.full_dispatch_request()
File “F:\python\lib\site-packages\flask\app.py”, line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File “F:\python\lib\site-packages\flask\app.py”, line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “F:\python\lib\site-packages\flask_compat.py”, line 39, in reraise
raise value
File “F:\python\lib\site-packages\flask\app.py”, line 1949, in full_dispatch_request
rv = self.dispatch_request()
File “F:\python\lib\site-packages\flask\app.py”, line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File “D:\QinMan\order\web\controllers\user\User.py”, line 28, in login
user_info = User.query.filter_by( login_name = login_name ).first()
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3287, in first
ret = list(self[0:1])
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3065, in getitem
return list(res)
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3389, in iter
return self._execute_and_instances(context)
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3411, in _execute_and_instances
querycontext, self._connection_from_session, close_with_result=True
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3426, in _get_bind_args
mapper=self._bind_mapper(), clause=querycontext.statement, **kw
File “F:\python\lib\site-packages\sqlalchemy\orm\query.py”, line 3404, in _connection_from_session
conn = self.session.connection(**kw)
File “F:\python\lib\site-packages\sqlalchemy\orm\session.py”, line 1133, in connection
execution_options=execution_options,
File “F:\python\lib\site-packages\sqlalchemy\orm\session.py”, line 1139, in _connection_for_bind
engine, execution_options
File “F:\python\lib\site-packages\sqlalchemy\orm\session.py”, line 432, in _connection_for_bind
conn = bind._contextual_connect()
File “F:\python\lib\site-packages\sqlalchemy\engine\base.py”, line 2242, in _contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File “F:\python\lib\site-packages\sqlalchemy\engine\base.py”, line 2276, in _wrap_pool_connect
return fn()
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 363, in connect
return _ConnectionFairy._checkout(self)
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 773, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 492, in checkout
rec = pool._do_get()
File “F:\python\lib\site-packages\sqlalchemy\pool\impl.py”, line 139, in _do_get
self._dec_overflow()
File “F:\python\lib\site-packages\sqlalchemy\util\langhelpers.py”, line 68, in exit
compat.reraise(exc_type, exc_value, exc_tb)
File “F:\python\lib\site-packages\sqlalchemy\util\compat.py”, line 153, in reraise
raise value
File “F:\python\lib\site-packages\sqlalchemy\pool\impl.py”, line 136, in _do_get
return self._create_connection()
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 308, in _create_connection
return _ConnectionRecord(self)
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 437, in init
self.__connect(first_connect_check=True)
File “F:\python\lib\site-packages\sqlalchemy\pool\base.py”, line 652, in __connect
connection = pool.invoke_creator(self)
File “F:\python\lib\site-packages\sqlalchemy\engine\strategies.py”, line 114, in connect
return dialect.connect(*cargs, **cparams)
File “F:\python\lib\site-packages\sqlalchemy\engine\default.py”, line 489, in connect
return self.dbapi.connect(*cargs, **cparams)
File "F:\python\lib\site-packages\MySQLdb_init
.py", line 86, in Connect
return Connection(*args, **kwargs)
File “F:\python\lib\site-packages\MySQLdb\connections.py”, line 204, in init
super(Connection, self).init(*args, **kwargs2)
TypeError: ‘User’ is an invalid keyword argument for this function
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

写回答

2回答

编程浪子

2020-03-29

你好

该问题远程查看应该是python3.5版本的问题,3.5这个版本问题很多,建议换成最新的

1
0

编程浪子

2020-03-29

你好

加我 QQ:1586538192,我远程看看。


0
1
纪文
好,我现在加
2020-03-29
共1条回复

Python Flask构建微信小程序订餐系统(可用于毕设)

微信小程序 + Python Flask 打造订餐系统全栈应用,可用于毕设。

1709 学习 · 1904 问题

查看课程