Curve icon indicating copy to clipboard operation
Curve copied to clipboard

generate() got an unexpected keyword argument 'spec'

Open Clqsin45 opened this issue 7 years ago • 11 comments

error message deploy api... Collecting swagger-py-codegen==0.2.9 Collecting dpath (from swagger-py-codegen==0.2.9) Requirement already satisfied: six in ./venv/lib/python3.6/site-packages (from swagger-py-codegen==0.2.9) (1.11.0) Collecting PyYAML (from swagger-py-codegen==0.2.9) Requirement already satisfied: click in ./venv/lib/python3.6/site-packages (from swagger-py-codegen==0.2.9) (7.0) Requirement already satisfied: jinja2 in ./venv/lib/python3.6/site-packages (from swagger-py-codegen==0.2.9) (2.10) Requirement already satisfied: MarkupSafe>=0.23 in ./venv/lib/python3.6/site-packages (from jinja2->swagger-py-codegen==0.2.9) (1.0) Installing collected packages: dpath, PyYAML, swagger-py-codegen Successfully installed PyYAML-3.13 dpath-1.4.2 swagger-py-codegen-0.2.9 Traceback (most recent call last): File "xxx/Curve/venv/bin/swagger_py_codegen", line 11, in <module> sys.exit(generate()) File "xxx/Curve/venv/lib/python3.6/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "xxx/Curve/venv/lib/python3.6/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "xxx/Curve/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "xxx/Curve/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) TypeError: generate() got an unexpected keyword argument 'spec'

env: python 3.6 / 2.7 (i have tried both of them) ubuntu 18.04 node.js 10.13.0 (includes npm 6.4.1)

seems it occured when executed swagger_py_codegen --ui --spec -s doc/web_api.yaml api -p curve

Thanks a lot !

Clqsin45 avatar Oct 30 '18 10:10 Clqsin45

你好 能够告诉我怎么运行吗 这个是flask 框架 还是什么呢?wo没再怎么看懂,node。js 没接触过,,可以告诉吗,谢谢

wonewbird avatar Nov 29 '18 08:11 wonewbird

@Clqsin45 你好 这个问题持续未能复现,我们仍在继续跟进

minorcong avatar Nov 30 '18 03:11 minorcong

@wonewbird

  1. 以后类似问题麻烦单开一个 issue 谢谢
  2. flask 框架,nodejs 部分如果不需修改,可以直接使用脚本直接启动

minorcong avatar Nov 30 '18 03:11 minorcong

./control.sh start 启动同样遇到这个问题,MacOS, python 3.6.4,nodejs v10.14.1,npm 6.4.1:

Installing collected packages: PyYAML, dpath, swagger-py-codegen Successfully installed PyYAML-3.13 dpath-1.4.2 swagger-py-codegen-0.2.9 Traceback (most recent call last): File "/Desktop/Curve-master/venv/bin/swagger_py_codegen", line 11, in sys.exit(generate()) File "/Desktop/Curve-master/venv/lib/python3.6/site-packages/click/core.py", line 764, in call return self.main(*args, **kwargs) File "/Desktop/Curve-master/venv/lib/python3.6/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Desktop/Curve-master/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Desktop/Curve-master/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) TypeError: generate() got an unexpected keyword argument 'spec'

解决了:click的版本修改,在control.sh中103行source ${G_VENV_DIR}/bin/activate后添加pip install click==6.7

wonder2025 avatar Dec 02 '18 02:12 wonder2025

@wonder2025 感谢你的帮助,请问你愿意发起 pull request 来合并修改吗 另,click 版本修改的建议位置:https://github.com/baidu/Curve/blob/master/api/requirements.txt

minorcong avatar Dec 04 '18 02:12 minorcong

I have similar error like "Traceback (most recent call last): File "/Users/wangjindong02/Envs/aiops/Curve/venv/bin/swagger_py_codegen", line 10, in sys.exit(generate()) File "/Users/wangjindong02/Envs/aiops/Curve/venv/lib/python2.7/site-packages/click/core.py", line 764, in call return self.main(*args, **kwargs) File "/Users/wangjindong02/Envs/aiops/Curve/venv/lib/python2.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Users/wangjindong02/Envs/aiops/Curve/venv/lib/python2.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/wangjindong02/Envs/aiops/Curve/venv/lib/python2.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) TypeError: generate() got an unexpected keyword argument 'swagger' " I installed click==6.7 as @wonder2025 said but not resolved yet. My Env is MacOS, python 3.7.0,nodejs v10.14.1,npm 6.4.1

wjd92 avatar Feb 22 '19 07:02 wjd92

@wjdhuster2018 请问你解决了吗? Have you resolved it ?

jagerzhang avatar Mar 29 '19 08:03 jagerzhang

installed click==6.7 as @wonder2025 said but not resolved yet. My Env is Linux, python 2.7.0,nodejs v10.15.3,npm 6.4.1

idevede avatar Apr 17 '19 14:04 idevede

The problem seems to be the API of swagger package has changed. This worked for me:

pip install --upgrade git+https://github.com/guokr/swagger-py-codegen/#egg=swagger-py-codegen

navneeth avatar Apr 24 '19 07:04 navneeth

@wjdhuster2018 We have the same error,Please uninstall the swagger_py_codegen and reinstall it with version--0.40,it solved my problem

zakured1 avatar May 13 '19 10:05 zakured1

I'm sorry that I haven't found a graceful solution for the request/click/swagger_py_codegen problem in the past time. I'm going to submit the generated code to the repository later.

minorcong avatar May 13 '19 11:05 minorcong