1

I am trying to build a project using Google Cloud Endpoints, following this guide: Quickstart for Cloud Endpoints Frameworks on App Engine.

I am stuck at the step of generating the OpenAPI configuration file, where I need to run this command:

Attempt One

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

I get this error:

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

Attempt Two

I have tried the same command with sudo, which returned this error:

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

Attempt Three

I have tried to cd lib/endpoints to run the command from the same folder as endpointscfg.py file:

$ 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')

Attempt Four

Running it with python returns a different kind of issue:

$ 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
4

2 回答 2

0

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

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

试过了,它对我有用。我会尝试让它变得更好(通过修复文档或在 repo 中应用一些修复),但这可能会在此期间为您提供所需的东西。

于 2016-10-07T23:11:55.740 回答
0

我遇到了完全相同的问题并尝试了同样的事情。对我有用的是:

chmod +x lib/endpoints/endpointscfg.py

然后再次运行命令。

于 2016-10-18T15:52:36.520 回答