编程语言
首页 > 编程语言> > python-运行endpointscfg.py get_swagger_spec错误

python-运行endpointscfg.py get_swagger_spec错误

作者:互联网

我正在尝试按照以下指南使用Google Cloud Endpoints构建项目:Quickstart for Cloud Endpoints Frameworks on App Engine.

我被困在生成OpenAPI配置文件的步骤中,我需要在其中运行以下命令:

尝试一次

$lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com

我收到此错误:

-bash: lib/endpoints/endpointscfg.py: Permission denied

尝试两次

我用sudo尝试了相同的命令,该命令返回此错误:

sudo: lib/endpoints/endpointscfg.py: command not found

尝试三

我试图通过cd lib / endpoints从endpointscfg.py文件所在的文件夹中运行命令:

$cd lib/endpoints
$endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com

usage: /Users/myName/google-cloud-sdk/platform/google_appengine/endpointscfg.py
       [-h] {get_client_lib, get_discovery_doc} ...
/Users/myName/google-cloud-sdk/platform/google_appengine/endpointscfg.py: error: argument {get_client_lib, get_discovery_doc}: invalid choice: 'get_swagger_spec' (choose from 'get_client_lib', 'get_discovery_doc')

尝试四

使用python运行它会返回另一种问题:

$python lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com

Traceback (most recent call last):
  File "lib/endpoints/endpointscfg.py", line 59, in <module>
    import _endpointscfg_setup  # pylint: disable=unused-import
  File "/Users/myName/lab/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/_endpointscfg_setup.py", line 98, in <module>
    _SetupPaths()
  File "/Users/myName/lab/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/_endpointscfg_setup.py", line 94, in _SetupPaths
    from google.appengine.ext import vendor
ImportError: No module named appengine.ext

解决方法:

与其直接运行,不如尝试使用Python运行它:

python lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com

尝试了一下,它只是为我工作.我会尝试使它变得更好(通过修复文档或在存储库中应用一些修复程序),但是在过渡期间可能会为您带来所需.

标签:google-cloud-sdk,python,google-app-engine,google-cloud-platform,google-cloud-end
来源: https://codeday.me/bug/20191012/1902800.html