运行时出错端点scfg.py大摇大摆

2024-10-04 05:20:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用Google云端点构建一个项目,遵循以下指南:Quickstart for Cloud Endpoints Frameworks on App Engine。在

我需要在生成配置文件的步骤中运行open命令:

尝试一次

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

我得到这个错误:

^{pr2}$

尝试两次

我用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

Tags: py命令getmainlibswaggergoogleusers
2条回答

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

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

试过了,对我很有效。我会尽力让它变得更好(要么修改文档,要么在回购中应用一些修复),但这可能会让你在过渡期间得到所需的东西。在

我也遇到了同样的问题,尝试了同样的方法。对我有用的是:

chmod +x lib/endpoints/endpointscfg.py

然后再次运行命令。在

相关问题 更多 >