het.oosten
unread,Jul 26, 2011, 2:29:18 AM7/26/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
On the memcached mailing list they suspected this is a Django/python
issue so I started a thread here. A user named dormando replied that
the problem below looks like a connection failure (sock has gone null)
I use memcached on a low traffic website with Django 1.2.4. Sometimes
I get this error message in my mail (full error below):
AttributeError: 'NoneType' object has no attribute 'recv'
I use memcache to cache some Twitter messages. I fetch them using this
in a context-preprocessor:
def latest_tweet( request ):
tweet = cache.get( 'tweet_mysite_nl' )
if tweet:
return {"tweet": tweet}
else:
tweet = {}
return {"tweet": tweet}
I tried to trigger this error hitting refresh all the time, but with
my pc everything works fine.
I update the cache twice an hour with another view, using cron
(because I don't want to rely on an external site for performance):
def update_tweet(request):
import time
from django.conf import settings
from django.core.cache import cache
import twitter
tweet = twitter.Api().GetUserTimeline( settings.TWITTER_USER,
count=5 )
for s in tweet:
s.date =
datetime.datetime(*(time.strptime( s.created_at, "%a %$
cache.set( 'tweet_mysite_nl', tweet,
settings.TWITTER_TIMEOUT )
return HttpResponseRedirect('mysite')
Here is the full error message:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/views/generic/
simple.py", line 16, in direct_to_template
c = RequestContext(request, dictionary)
File "/usr/lib/python2.4/site-packages/django/template/context.py",
line 149, in __init__
self.update(processor(request))
File "/home/wieskamp/django/wieskamp/verkoop/context_processors.py",
line 8, in latest_tweet
tweet = cache.get( 'tweet_mysite_nl' )
File "/usr/lib/python2.4/site-packages/django/core/cache/backends/
memcached.py", line 48, in get
val = self._cache.get(smart_str(key))
File "/usr/lib/python2.4/site-packages/memcache.py", line 337, in
get
rkey, flags, rlen, = self._expectvalue(server)
File "/usr/lib/python2.4/site-packages/memcache.py", line 411, in
_expectvalue
line = server.readline()
File "/usr/lib/python2.4/site-packages/memcache.py", line 511, in
readline
recv = self.socket.recv
AttributeError: 'NoneType' object has no attribute 'recv'