python 类型错误:__init__()获得意外的关键字参数“unbound_message”

izkcnapc  于 2023-01-08  发布在  Python
关注(0)|答案(4)|浏览(776)

当我尝试从flask_restx导入字段时,出现了上述错误。

from flask_restx import fields

出什么问题了。它在我的本地机器上工作,但在远程机器上不工作。
完整错误跟踪:

File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
    mod = builtins.__org_import__(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask_restx/__init__.py", line 4, in <module>
    from . import fields, reqparse, apidoc, inputs, cors
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
    mod = builtins.__org_import__(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask_restx/fields.py", line 16, in <module>
    from flask import url_for, request
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
    mod = builtins.__org_import__(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
    mod = builtins.__org_import__(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
    mod = builtins.__org_import__(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'
pgpifvop

pgpifvop1#

我把 flask==2.1.3 添加到我的要求中,它起作用了。我认为这是flask/当前最新版本的问题

c2e8gylq

c2e8gylq2#

我的requirements.txt中有一个旧版本的Werkzeug需要删除

tp5buhyn

tp5buhyn3#

从requirements.txt添加最新版本的flask在这里您可以知道最新的当前版本
https://pypi.org/project/Flask/
Flask==2.2.2这是当前版本,请从上面的链接中确认。

相关问题