I am NOT doing unit testing.
I am just running following 2 commands on my Windows10 machine with Python2.7 and I am getting the infamous assertion error:
No api proxy found for service “memcache”
This is the code:
import cloudstorage as cstorage
cstorage.copy2("/nosuchbucket/nosuchfile1","/nosuchbucket/nosuchfile2")
Any pointers on what could be wrong?
Environment:
- Google Cloud SDK 202.0.0
- app-engine-python 1.9.70
- app-engine-python-extras 1.9.69
- Python 2.7.14
2
Answers
I also found a kind-of-workaround yesterday which can be used for testing purpose.
Just import the testbed and init necessary stubs ( or all of them)
from google.appengine.ext import testbed testbed = testbed.Testbed()
testbed.activate()
testbed.init_datastore_v3_stub()
testbed.init_memcache_stub()
testbed.init_urlfetch_stub()
testbed.init_app_identity_stub()
testbed.init_blobstore_stub()
Now the error is gone and I can use cloudstorage API.
That particular library is the AppEngine Google Cloud Storage client library, designed to be used by a GAE application code.
Such code cannot be executed in a standalone manner as you attempted to do, it needs to be executed inside (and complemented by) the GAE sandbox environment (either the local development server or the real GAE infra when deployed).
See also related import cloudstorage, ImportError: No module named google.appengine.api