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

时间:2019-07-10 08:10:35

标签: python google-app-engine google-app-engine-python

我正在尝试下载我现有的Google Appengine项目之一的最新版本,并且我讨厌看到这些错误!我正在google sdk python 2.7 dir中运行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

1 个答案:

答案 0 :(得分:0)

系统上已安装的文件可能有问题。我尝试重现该问题,但是出现了另一种错误:

  

回溯(最近一次通话最近):文件“ C:\ Program Files   (x86)\ Google \ google_appengine \ appcfg.py“,第133行,在   run_file(文件,globals())文件“ C:\ Program Files   (x86)\ Google \ google_appengine \ appcfg.py“,第129行,在run_file中   execfile(_PATHS.script_file(script_name),globals_)NameError:名称   'execfile'未定义

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

从GAE下载源代码:

  • 它仅适用于App Engine标准版应用程序
  • 您可以确认是否像在Google Cloud Console中那样选择特定服务的版本。下拉菜单Tools不会为Flex应用程序提供选项 Source ,而仅为 Standard 应用程序
  • 您应该已安装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.7 from here
  4. Quickstart for Windows安装和初始化Google Cloud SDK
  5. 以管理员身份运行Google Cloud SDK并执行$ gcloud init
  6. 然后基于gcloud config set doc执行$ gcloud config set project [PROJECT_ID]
  7. 执行$ gcloud components install app-engine-python以基于Download the Cloud SDK安装GAE Python
  8. 执行$ gcloud components install app-engine-python-extras以安装其他功能。
  9. 执行$ gcloud components update以更新组件。
  10. 按照Download and install the original App Engine SDK for Python
  11. 中所述安装适用于Python的GAE SDK。
  12. 重新启动计算机
  13. Administrator的身份运行Google Cloud SDK
  14. 执行命令$ gcloud info以验证是否设置了正确的项目和正确的用户帐户。
  15. 如果未正确设置,请执行$ gcloud init并正确设置以验证SDK。
  16. 执行appcfg.py -A [PROJECT_ID] -V [VERSION_NAME] download_app C:\PATH\TO\SAVE\SOURCE_CODE 确保该版本引用的是GAE STANDARD应用
  17. 它将重定向到浏览器页面,以便您可以使用与设置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 ---