Question

So, on my quest to find a good Python IDE that support webapp2 I was suggested to use Eclipse with the pydev's plugin.

After making a successful install in a clean version of Eclipse, I created a GAE project. Every thing seems to work fine, except for memcache. For some reason the IDE does not compile the following python code, even though the code is perfectly legit:

from google.appengine.api import memcache

class FlushMemCache(BlogHandler):
    def get(self):
        memcache.flush_all()
        self.redirect(BLOG_FRONT_URL)

All I get is the error Undefined variable from import: flush_all. This happens for all methods from memcache. What is weird is that if I run this on GAE without using Eclipse, the webpage loads and everything works fine.

Furthermore, when I press F2 for focus and use Eclipse's console to test some code, I get the following errors as well:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
/usr/bin/python 2.7.4 (default, Sep 26 2013, 03:20:26) 
[GCC 4.7.3]
PyDev console: using default backend (IPython not available).
from google.appengine.api import memcache
memcache.set('hello world', 'ola')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/pedro/google_appengine/google/appengine/api/memcache/__init__.py", line 763, in set
    namespace=namespace)
  File "/home/pedro/google_appengine/google/appengine/api/memcache/__init__.py", line 868, in _set_with_policy
    time, '', namespace)
  File "/home/pedro/google_appengine/google/appengine/api/memcache/__init__.py", line 970, in _set_multi_async_with_policy
    (server_keys, user_key))
  File "/home/pedro/google_appengine/google/appengine/api/memcache/__init__.py", line 380, in _make_async_call
    rpc = create_rpc()
  File "/home/pedro/google_appengine/google/appengine/api/memcache/__init__.py", line 294, in create_rpc
    return apiproxy_stub_map.UserRPC('memcache', deadline, callback)
  File "/home/pedro/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 413, in __init__
    self.__rpc = CreateRPC(service, stubmap)
  File "/home/pedro/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 67, in CreateRPC
    assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "memcache"

Have I missed some configuration detail ? How can I fix this?

Was it helpful?

Solution

Are you sure the Google App Engine DEV server is started ? I think this is your problem. Your code is valid but the DEV server need to be started to respond at your call and to run the memcache mechanism.

If you don't want to start Google App Engine and just import the memcache library on your project, you can see this solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top