baidu / Curve

An Integrated Experimental Platform for time series data anomaly detection.
http://curve.baidu.com
Apache License 2.0
529 stars 134 forks source link

generate() got an unexpected keyword argument 'spec' #62

Open Clqsin45 opened 5 years ago

Clqsin45 commented 5 years ago

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 !

wonewbird commented 5 years ago

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

minorcong commented 5 years ago

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

minorcong commented 5 years ago

@wonewbird

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

./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

minorcong commented 5 years ago

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

wjd92 commented 5 years ago

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

jagerzhang commented 5 years ago

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

idevede commented 5 years ago

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

navneeth commented 5 years ago

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
zakured1 commented 5 years ago

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

minorcong commented 5 years ago

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.