Error starting endpointscfg.py get_swagger_spec

I am trying to create a project using Google Cloud Endpoints by following this guide: Quick start for cloud endpoint platforms in App Engine .

I was stuck at the stage of creating the OpenAPI configuration file, where I need to run this command:

Attempt 1

$ 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 tried the same command with sudo that returned this error:

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

Attempt Three

I tried 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 another problem:

 $ 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 
+1
source share
2 answers

Instead of starting it directly, try starting it with Python, a la:

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

Tried this and it just worked for me. I will try to do it better (either by fixing documents, or applying some corrections in the repo), but this can provide you with what you need in the interim.

0
source

I had the same problem and tried the same thing. What worked for me:

 chmod +x lib/endpoints/endpointscfg.py 

Then run the command again.

0
source

Source: https://habr.com/ru/post/1264376/


All Articles