简体   繁体   English

TypeError: __init__() 得到了一个意外的关键字参数 'unbound_message'

[英]TypeError: __init__() got an unexpected keyword argument 'unbound_message'

I got the above error when I try to import fields from flask_restx .当我尝试从flask_restx导入字段时出现上述错误。

from flask_restx import fields

What is the problem.问题是什么。 It works on my local machine but not on remote machine.它适用于我的本地机器,但不适用于远程机器。

Full error trace:完整的错误跟踪:

  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'

I added flask==2.1.3 to my requirements and it worked.我在我的要求中添加了flask==2.1.3并且它起作用了。 I think this is a problem with the currently lastest versions of flask/我认为这是当前最新版本的烧瓶/

I had an older version of Werkzeug in my requirements.txt that needed removing我的 requirements.txt 中有一个旧版本的 Werkzeug,需要删除

Add latest version of flask from requirements.txt Here you can know the latest current version从requirements.txt添加最新版本的flask 在这里可以知道最新的当前版本

https://pypi.org/project/Flask/ https://pypi.org/project/Flask/

Flask==2.2.2 This is current version make sure from the link above. Flask==2.2.2 这是当前版本,请从上面的链接中确认。

pip install Flask==2.1.3 pip 安装 Flask==2.1.3

The following blog has all the fixes in detail: https://bobbyhadz.com/blog/python-typeerror-init-got-an-unexpected-keyword-argument-unbound-message以下博客详细介绍了所有修复: https://bobbyhadz.com/blog/python-typeerror-init-got-an-unexpected-keyword-argument-unbound-message

Check if there are outdated versions of Flask/Werkzeug: pip list --outdated (replacing pip with pip3 as needed)检查是否有Flask/Werkzeug的过时版本: pip list --outdated (根据需要将pip替换为pip3

If Flask/Werkzeug are listed, consider upgrading them: pip install Flask Werkzeug --upgrade (with the caveat that doing so may break packages and/or dependencies in your project)如果列出了 Flask/Werkzeug,请考虑升级它们: pip install Flask Werkzeug --upgrade (注意这样做可能会破坏项目中的包和/或依赖项)

Information taken from here which was provided by an earlier response in this thread. 从此处获取的信息由该线程中的早期响应提供。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError at &#39;&#39; __init__() 得到一个意外的关键字参数 &#39;&#39; - TypeError at '' __init__() got an unexpected keyword argument '' 类型错误:__init__() 得到了一个意外的关键字参数“宽度” - TypeError: __init__() got an unexpected keyword argument 'width' TypeError:__init __()获得了意外的关键字参数&#39;log_path&#39; - TypeError: __init__() got an unexpected keyword argument 'log_path' Python openpyxl TypeError:__init __()获得了意外的关键字参数&#39;pivotButton&#39; - Python openpyxl TypeError: __init__() got an unexpected keyword argument 'pivotButton' Telethon Python TypeError:__init__() 得到了一个意外的关键字参数“hash” - Telethon Python TypeError: __init__() got an unexpected keyword argument 'hash' 类型错误:__init__() 得到了一个意外的关键字参数“轴” - TypeError: __init__() got an unexpected keyword argument 'axis' TypeError:__init __()获得了意外的关键字参数“父母” - TypeError: __init__() got an unexpected keyword argument 'parent' TypeError:__init __()获得了意外的关键字参数“ trainable” - TypeError: __init__() got an unexpected keyword argument 'trainable' 如何修复“TypeError: __init__() got an意外关键字参数‘sender’” - How to fix 'TypeError: __init__() got an unexpected keyword argument 'sender'' 访问API:TypeError:__init __()获得了意外的关键字参数&#39;encoding&#39; - Accessing API: TypeError: __init__() got an unexpected keyword argument 'encoding'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM