I'm trying to use the App Engine Remote API in Google Cloud Shell, but keep getting the error "ImportError: No module named appengine.tools".
First, I've followed these steps to set my Cloud Shell to a clean state.
Then, I attempt to start the API shell with the following command:
/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py -s [myprojectID].appspot.com
First, I get the error "-bash: /google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py: Permission denied" so I navigate to the file and do
sudo chmod +x remote_api_shell.py
Then, when I attempt the command again, I get the ImportError above.
I've looked at a few similar threads (here) and (here) and users seem to report that doing "sudo pip uninstall protobuf" fixed their issue, but that isn't doing the trick for me.
Another suggestion was adding the App Engine SDK to the PYTHONPATH, so I've tried executing
export PYTHONPATH=/usr/bin/python2.7
export GAE_SDK_ROOT="/google/google-cloud-sdk/platform/google_appengine/"
export PYTHONPATH=${GAE_SDK_ROOT}:${PYTHONPATH}
But the error persists. I think the issue is reflected here:
>>> import google
>>> print google.__path__
['/usr/local/lib/python2.7/dist-packages/google']
Is there a way to quickly fix this while preserving as much of the default state of the Cloud Shell as possible? Since the Cloud Shell is ephemeral, I suppose the process will need to be repeated.
I have configured my application to enable remote access, though I don't believe I've gotten far enough for that to be the issue.
All Gcloud components are up to date, as I suppose is guaranteed when I clean the Cloud Shell state.
Prepending "python" or "python2" to the command results in the same error.
Edited to add the full error message:
Traceback (most recent call last):
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 29, in <module>
from google.appengine.tools import os_compat
ImportError: No module named appengine.tools