Can I save a list in Memcache in Google-AppEngine in Python?
<p>I want to save a list in MemCache in AppEngine with Python and I am having the next error : </p>

<p>TypeError: <strong>new</strong>() takes exactly 4 arguments (1 given).</p>

<p>This is the link of the image with the error : 
<a href="http://i.stack.imgur.com/we3VU.png" rel="nofollow">http://i.stack.imgur.com/we3VU.png</a></p>

<p>And this is my code :</p>

<pre><code>def get_r_post_relation(self, url, update = False) :
        sufix = "r"
        key = sufix + url
        list_version = memcache.get(key)
        if not list_version or update :
            logging.error("LIST VERSION QUERY")
            postobj = get_wiki_post(url)
            list_version = WikiPostVersion.query().filter(WikiPostVersion.r_post == postobj.key)
            memcache.set(key, list_version)
        return list_version
</code></pre>

<p>You are not storing a list.  You are storing a query object.  To store a list, use <code>.fetch()</code>:</p>

<pre><code>list_version = WikiPostVersion.query().filter(WikiPostVersion.r_post == postobj.key).fetch()
</code></pre>

<p>You can store a simple query object, but when you add <code>.order()</code> or <code>.filter()</code>, you'll get a pickling error.  Change to list, and you're all set.</p>

<p>Remember, a query object doesn't have any entities in it.  It is simply a set of instructions that will go and retrieve the entities when used later with a <code>.get()</code> or <code>.fetch()</code>.  So, you are trying to store a python command set, when your intention is to store the actual entity list.</p>

python google-app-engine memcached