memcache module working?

45 views
Skip to first unread message

Tim

unread,
May 28, 2008, 7:57:32 PM5/28/08
to Google App Engine
Is the memcache module currently supported and working?

from google.appengine.api import memcache
will give me a:
google undefined, memcache undefined
<type 'exceptions.ImportError'>: cannot import name memcache

Karim A.

unread,
May 28, 2008, 9:11:20 PM5/28/08
to Google App Engine
I was asking myself the same question!
And even on the production server (i.e. live version) it gives me this
error:

File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 370, in get
self._do_unpickle)
File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 188, in _decode_value
value = do_unpickle(stored_value)
File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 251, in DoUnpickle
return self._unpickler_instance.load()
File "/base/python_dist/lib/python2.5/pickle.py", line 852, in load
dispatch[key](self)
File "/base/python_dist/lib/python2.5/pickle.py", line 1149, in
load_binget
self.append(self.memo[repr(i)])
KeyError: '2'

Chris Tan

unread,
May 29, 2008, 11:24:24 AM5/29/08
to Google App Engine
it seems to work for on the production server:

from google.appengine.api import memcache
c = memcache.Client()
c.add("bbq", "asdf")
print c.get("bbq")
>> asdf

Karim A.

unread,
May 29, 2008, 12:18:23 PM5/29/08
to Google App Engine
I resolved my issue by wrapping
the memcache.get() call in try: except: statement

from google.appengine.api import memcache

try:
value = memcache.get('key')
except:
value = None

if not value:
get_it_from_db

and I use memcache.set('key', value)

It works now, but I'm not using the Client Class.
Am I wrong in not doing so?

Karim
--
http://feedego.com
The revenge of "ego" over social web

Aral Balkan

unread,
May 31, 2008, 11:45:42 AM5/31/08
to Google App Engine
I'm getting the same error (running the latest SDK with the Django
Helper).

Aral

On May 29, 12:57 am, Tim <timborm...@gmail.com> wrote:
> Is thememcachemodule currently supported and working?

Aral Balkan

unread,
May 31, 2008, 11:59:21 AM5/31/08
to Google App Engine
Added an issue for this:
http://code.google.com/p/googleappengine/issues/detail?id=416

Aral

On May 31, 4:45 pm, Aral Balkan <aralbal...@gmail.com> wrote:
> I'm getting the same error (running the latest SDK with the Django
> Helper).
>
> Aral
<snip>

Sylvain

unread,
May 31, 2008, 12:05:52 PM5/31/08
to Google App Engine
Same bug here, and it's random.

------------------------------------------------
'dict' object is not callable
Traceback (most recent call last):
File "/base/data/home/apps/testgapp/1.2/main.py", line 121, in get
img = memcache.get(key)
File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 370, in get
self._do_unpickle)
File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 188, in _decode_value
value = do_unpickle(stored_value)
File "/base/python_lib/versions/1/google/appengine/api/memcache/
__init__.py", line 251, in DoUnpickle
return self._unpickler_instance.load()
File "/base/python_dist/lib/python2.5/pickle.py", line 852, in load
dispatch[key](self)
File "/base/python_dist/lib/python2.5/pickle.py", line 1126, in
load_reduce
value = func(*args)
TypeError: 'dict' object is not callable
------------------------------------------------

Sylvain

unread,
May 31, 2008, 12:14:24 PM5/31/08
to Google App Engine

bjtitus

unread,
Jun 1, 2008, 12:55:11 AM6/1/08
to Google App Engine
I'm getting the same error as Karim in production. It's random, but it
occurs very frequently. I haven't yet implemented the try: except:
statement but it would not be an ideal fix for this. I don't see an
issue relating to this "Key Error" issue on Google's servers. Karim's
created issue just references the lack of an installed Memcache folder
in the local SDK but I have the current folders and don't have a
problem running it locally but only have problems on the server.

On May 28, 8:11 pm, "Karim A." <direct...@gmail.com> wrote:
> I was asking myself the same question!
> And even on the production server (i.e. live version) it gives me this
> error:
>
> File "/base/python_lib/versions/1/google/appengine/api/memcache/
> __init__.py", line 370, in get
>     self._do_unpickle)
>   File "/base/python_lib/versions/1/google/appengine/api/memcache/
> __init__.py", line 188, in _decode_value
>     value = do_unpickle(stored_value)
>   File "/base/python_lib/versions/1/google/appengine/api/memcache/
> __init__.py", line 251, in DoUnpickle
>     return self._unpickler_instance.load()
>   File "/base/python_dist/lib/python2.5/pickle.py", line 852, in load
>     dispatch[key](self)
>   File "/base/python_dist/lib/python2.5/pickle.py", line 1149, in
> load_binget
>     self.append(self.memo[repr(i)])
> KeyError: '2'
>
> On May 29, 12:57 am, Tim <timborm...@gmail.com> wrote:
>
> > Is thememcachemodule currently supported and working?
>
> > from google.appengine.api importmemcache
> > will give me a:

Marzia Niccolai

unread,
Jun 2, 2008, 5:41:31 PM6/2/08
to google-a...@googlegroups.com
Hi,
 Concerning issue 416, the code for memcache should be in the Mac SDK by cd'ing in to the following directory:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api
Concerning issue 417, since I am still not able to replicate the error, any more information that could be provided would be very helpful.  Including:

1. Application IDs if this is happening in production
2. If it is happening on the SDK:
   - OS and version
   - Current Python installation
3. Information about what you are storing in memcache including
4. The code that caused the stack trace, as well as relevant related code

Thanks for your help!
-Marzia
Message has been deleted

Aral Balkan

unread,
Jun 2, 2008, 6:09:32 PM6/2/08
to Google App Engine
Hi Marzia,

I just responded to this on the ticket (http://code.google.com/p/
googleappengine/issues/detail?id=416). I still think it may be an
issue with the Mac installer and/or an issue that only affects pre-Mac
installer installations that updated using the Mac installer.

The workaround, for me, was to manually copy the google_appengine
folder in the app bundle to /usr/local/, where google_appengine was
for me previously.

Thanks,
Aral

On Jun 2, 10:41 pm, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
> Concerning issue 416, the code for memcache should be in the Mac SDK by
> cd'ing in to the following directory:
>
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api
<snip>

Marzia Niccolai

unread,
Jun 2, 2008, 6:13:56 PM6/2/08
to google-a...@googlegroups.com
Hi,
 To be clear, the new App Engine Launcher will not remove or over install the files created by the old App Engine Installer for Mac.  The old files in /usr/local/ will remain unless they are removed or overwritten (for instance, you could update the files /usr/local by using the zip, or copying the Launcher files as you did).

-Marzia

Paul Marrington

unread,
Jun 3, 2008, 12:00:44 AM6/3/08
to Google App Engine
I delete the directory in /usr/local and created a soft link to the
equivalent one in the launcher. That way I did not need to change
Eclipse.

Sylvain

unread,
Jun 3, 2008, 5:44:54 AM6/3/08
to Google App Engine
I've updated the issue 417.

I hope it will help.

Best regards.



On Jun 2, 11:41 pm, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
> Concerning issue 416, the code for memcache should be in the Mac SDK by
> cd'ing in to the following directory:
>
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api
>
> Concerning issue 417, since I am still not able to replicate the error, any
> more information that could be provided would be very helpful. Including:
>
> 1. Application IDs if this is happening in production
> 2. If it is happening on the SDK:
> - OS and version
> - Current Python installation
> 3. Information about what you are storing in memcache including
> 4. The code that caused the stack trace, as well as relevant related code
>
> Thanks for your help!
> -Marzia
>

cgeorg

unread,
Jun 4, 2008, 10:45:13 AM6/4/08
to Google App Engine
This is happening to me too, when trying to retrieve a dictionary from
the memcache. I also updated and starred 417 - this is a big issue
for me! The dictionary I am caching results in a high-CPU request
every time it needs to be generated, and does not change often :(

Marzia Niccolai

unread,
Jun 4, 2008, 1:11:32 PM6/4/08
to google-a...@googlegroups.com
Hi,
 For the Memcache API, the key must be a string, and the value related to the key can be anything that is able to be pickled.

 In the case of dictionaries, the dictionary (and lists, tuples, etc) must contain only picklable objects.  If you would update the issue with information on what the memcached dictionary contains, I would appreciate it, as it will help us better troubleshoot what is happening.

Thanks,
Marzia

Sylvain

unread,
Jun 4, 2008, 3:04:04 PM6/4/08
to Google App Engine
Hi Marzia,

I've updated the issue 417. I hope it will help

Regards

On Jun 4, 7:11 pm, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
> For the Memcache API, the key must be a string, and the value related to
> the key can be anything that is able to be pickled.
>
> In the case of dictionaries, the dictionary (and lists, tuples, etc) must
> contain only picklable objects. If you would update the issue with
> information on what the memcached dictionary contains, I would appreciate
> it, as it will help us better troubleshoot what is happening.
>
> Thanks,
> Marzia
>

Aral Balkan

unread,
Jun 5, 2008, 5:20:29 PM6/5/08
to Google App Engine
Hi Marzia,

Thanks for the clarification. I wasn't sure if this was intended
behavior.

I guess it's going to be less of an issue as time goes on and if
anyone is affected by it, I'm sure they'll find this thread.

Aral

On Jun 2, 11:13 pm, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
> To be clear, the new App Engine Launcher will not remove or over install
> the files created by the old App Engine Installer for Mac. The old files in
> /usr/local/ will remain unless they are removed or overwritten (for
> instance, you could update the files /usr/local by using the zip, or copying
> the Launcher files as you did).
>
> -Marzia
<snip>
Reply all
Reply to author
Forward
0 new messages