无法在 Windows 10 下载 google App Engine 标准项目源

Unable to download google app engine standard project source in Windows 10

我正在尝试下载我现有的 google appengine 项目之一的最新版本,我已经厌倦了看到这些错误!我是 运行 google sdk python 2.7 目录中的 appcfg.py 命令。这是我 运行.

python "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py" download_app -A <project> -V <version> C:\DEV_Tools\Dump\

输出:

Traceback (most recent call last):
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py", line 133, in <module>
    run_file(__file__, globals())
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py", line 129, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py", line 66, in <module>
    from google.appengine.api import appinfo
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\appinfo.py", line 54, in <module>
    from google.appengine.api import validation
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\validation.py", line 46, in <module>
    from google.appengine._internal.ruamel import yaml
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\__init__.py", line 85, in <module>
    from google.appengine._internal.ruamel.yaml.main import *  # NOQA
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\main.py", line 19, in <module>
    from google.appengine._internal.ruamel.yaml.loader import BaseLoader, SafeLoader, Loader, RoundTripLoader  # NOQA
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\loader.py", line 10, in <module>
    from google.appengine._internal.ruamel.yaml.constructor import (
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\constructor.py", line 21, in <module>
    from google.appengine._internal.ruamel.yaml.comments import *                               # NOQA
  File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\comments.py", line 642, in <module>
    class CommentedMap(MutableMapping, ordereddict, CommentedBase):
  File "C:\DEV_Tools\Google\Python27\lib\abc.py", line 86, in __new__
    cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
TypeError: Error when calling the metaclass bases
    Cannot create a consistent method resolution
order (MRO) for bases CommentedBase, MutableMapping, ordereddict

您系统上安装的文件可能有问题。我试图重现该问题,但出现了不同类型的错误:

Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 133, in run_file(file, globals()) File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in run_file execfile(_PATHS.script_file(script_name), globals_) NameError: name 'execfile' is not defined

这是因为安装文件损坏。我已经完全重新安装了 Google App Engine Python SDK,它对我有用。请尝试以下步骤,因为它也可能对您有所帮助:

正在从 GAE 下载源代码:

  • 它仅适用于 App Engine 标准应用程序
  • 您可以在 Google Cloud Console 中确认,您可以在其中选择特定服务的版本。下拉菜单 Tools 不会为 Flex 应用程序提供选项 Source,但只为 Standard apps
  • 您应该 Python version 2.7 安装
  • 你应该有最新版本的App Engine SDK for Python

步骤:

  1. 转到控制面板>程序和功能并卸载您的Google App Engine SDK。
  2. 转到安装GAE的路径并删除google_appengine文件夹。在你的场合是 C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform
  3. 安装Python 2.7from here
  4. Quickstart for Windows
  5. 安装并初始化 Google Cloud SDK
  6. 运行 Google Cloud SDK 以管理员身份执行 $ gcloud init
  7. 然后根据gcloud config set doc执行$ gcloud config set project [PROJECT_ID]
  8. 执行$ gcloud components install app-engine-python安装GAE Python基于Download the Cloud SDK
  9. 执行 $ gcloud components install app-engine-python-extras 安装附加功能。
  10. 执行$ gcloud components update更新组件。
  11. Download and install the original App Engine SDK for Python
  12. 中所述,为 Python 安装 GAE SDK
  13. 重新启动计算机
  14. 运行 Google Cloud SDK 作为 Administrator
  15. 执行命令 $ gcloud info 以验证是否设置了正确的项目和正确的用户帐户。
  16. 如果设置不正确,请执行 $ gcloud init 并正确设置以验证 SDK。
  17. 执行 appcfg.py -A [PROJECT_ID] -V [VERSION_NAME] download_app C:\PATH\TO\SAVE\SOURCE_CODE 确保版本指的是 GAE STANDARD 应用程序
  18. 它会将您重定向到一个浏览器页面,这样您就可以使用您设置 SDK 进行身份验证的同一帐户登录。

你应该看到:

Authentication successful.
04:37 PM Fetching files...
04:37 PM [1/16] WEB-INF/lib/_ah_compiled_jsps-0000.jar
04:37 PM [2/16] WEB-INF/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar
04:37 PM [3/16] WEB-INF/min-quickstart-web.xml
04:37 PM [4/16] WEB-INF/appengine-generated/app.yaml
04:37 PM [5/16] WEB-INF/lib/org.eclipse.jdt.ecj-3.14.0.jar
04:37 PM [6/16] WEB-INF/web.xml
04:37 PM [7/16] WEB-INF/lib/org.mortbay.jasper.apache-el-8.5.24.2.jar
04:37 PM [8/16] WEB-INF/lib/org.mortbay.jasper.apache-jsp-8.5.24.2.jar
04:37 PM [9/16] source-context.json
04:37 PM [10/16] WEB-INF/quickstart-web.xml
04:38 PM [11/16] WEB-INF/classes/source-context.json
04:38 PM [12/16] WEB-INF/lib/org.apache.taglibs.taglibs-standard-spec-1.2.5.jar
04:38 PM [13/16] WEB-INF/appengine-web.xml
04:38 PM [14/16] WEB-INF/lib/org.eclipse.jetty.apache-jsp-9.4.14.v20181114-nolog

否则,如果是 GAE Flex,您将看到此错误:

54319 download_app C:\PATH\TO\SAVE\SOURCE_CODE 04:38 PM Host:
appengine.google.com 04:38 PM Fetching file list... Error 400: ---
begin server output --- Major version "[VERSION_NAME]" does not exist.
--- end server output ---