Search code examples
pythongoogle-app-enginegoogle-app-engine-python

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


I am trying to download the latest version of one of my existing google appengine projects & I am tired of seeing the errors! I am running the appcfg.py command inside the google sdk python 2.7 dir. Here's what I ran.

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\

Output :

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

Solution

  • There could be an issue with the installed files on your system. I have tried to reproduced the issue however I got different kind of error:

    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

    This was due to corrupted installation files. I have completely reinstalled Google App Engine Python SDK and it worked for me. Try the steps below as it might help you as well:

    Downloading Source code from GAE:

    • It only works for App Engine Standard apps
    • You can confirm that as in you Google Cloud Console where you choose the version of a specific service. The dropdown menu Tools will not give option Source for Flex apps but only for Standard apps
    • You should have Python version 2.7 installed
    • You should have latest version of App Engine SDK for Python

    Steps:

    1. Go to the Control Panel > Programs & Features and uninstall your Google App Engine SDK.
    2. Go to the path where GAE was installed and delete the google_appengine folder. In your occasion it is C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform
    3. Install Python 2.7 from here
    4. Install and initialize Google Cloud SDK from Quickstart for Windows
    5. Run Google Cloud SDK as administrator and execute $ gcloud init
    6. Then execute $ gcloud config set project [PROJECT_ID] based on gcloud config set doc.
    7. Execute $ gcloud components install app-engine-python to install GAE Python based on Download the Cloud SDK
    8. Execute $ gcloud components install app-engine-python-extras to install extras.
    9. Execute $ gcloud components update to update the components.
    10. Install GAE SDK for Python as it is mentioned in Download and install the original App Engine SDK for Python
    11. Restart your computer
    12. Run Google Cloud SDK as Administrator
    13. Execute the command $ gcloud info to verify that the correct project and correct user account is setup.
    14. If it is not setup properly the execute $ gcloud init and set up properly to authenticate the SDK.
    15. Execute appcfg.py -A [PROJECT_ID] -V [VERSION_NAME] download_app C:\PATH\TO\SAVE\SOURCE_CODE Make sure that the version is referring to an GAE STANDARD app
    16. It will redirect you to an browser page so you could login with the same account that you set up the SDK for authentication.

    You should see:

    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
    

    Otherwise if it is GAE Flex you will see this error:

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