Thanks for finding that thread btw, Tim. From: google-appengine@googlegroups.com [mailto:google-appengine@googlegroups.com] On Behalf Of timh Sent: Tuesday, October 1, 2013 5:17 AM To: google-appengine@googlegroups.com Subject: Re: [google-appengine] Re: __setattr__ and __getattr__ causing memcacahe error in 1.8.5
If you look at the SO q/a you will see the problem is with the __getattr__ T On Tuesday, October 1, 2013 6:14:53 PM UTC+8, Brian Becker wrote: I got rid of my __getattr__ and use @property for most of them. I didn't touch the __setattr__ but memcache is working just fine now. Strange. Brian From: google-a...@googlegroups.com<javascript:> [mailto:google-a...@googlegroups.com<javascript:>] On Behalf Of timh Sent: Tuesday, October 01, 2013 3:57 AM To: google-a...@googlegroups.com<javascript:> Subject: Re: [google-appengine] Re: __setattr__ and __getattr__ causing memcacahe error in 1.8.5 You are running into basic pickle problem then, See this question on stackoverflow http://stackoverflow.com/questions/2049849/why-cant-i-pickle-this-object The OP had exactly the same error as you. T On Tuesday, October 1, 2013 4:51:26 PM UTC+8, Brian Becker wrote: Neither, it is strictly a service which processes a string and spits back a result. From: google-a...@googlegroups.com<mailto:google-a...@googlegroups.com> [mailto:google-a...@googlegroups.com] On Behalf Of timh Sent: Tuesday, October 01, 2013 3:34 AM To: google-a...@googlegroups.com<mailto:google-a...@googlegroups.com> Subject: Re: [google-appengine] Re: __setattr__ and __getattr__ causing memcacahe error in 1.8.5 On further though I really think you are going about this the wrong way. You haven;'t said if you using ndb or db, if you are using ndb you should be providing a function to validator argument that will co-erce the data for you. Alternately subclass the Property to provide the functionality you want and not override __setattr__ which as you have found out could/will cause problems with new releases of the appengine runtime, as you are not using the public api for models/properties. Tim On Tuesday, October 1, 2013 1:51:13 PM UTC+8, Brian Becker wrote: Yes. def __setattr__( self, name, value ): if name == 'orig': # force value to string & kill whitespace value = unicode(value).strip() ###### Lots more cleaning is necessary # clean off ending characters value = value.rstrip(' ,;:)(') # Ps 3:1; cf. => Ps 3:1 if value[-3:] == 'and': value = value.replace('and','') if value[-2:] == 'cf': value = value.replace('cf','') # clean off ending characters again value = value.rstrip(' ,;:)(') self.__dict__[ 'orig'] = value From: google-a...@googlegroups.com<mailto:google-a...@googlegroups.com> [mailto:google-a...@googlegroups.com] On Behalf Of timh Sent: Tuesday, October 01, 2013 12:34 AM To: google-a...@googlegroups.com<mailto:google-a...@googlegroups.com> Subject: [google-appengine] Re: __setattr__ and __getattr__ causing memcacahe error in 1.8.5 You should show some code. Are you actually overriding __settattr__ and __getattr__ in your models ? T On Tuesday, October 1, 2013 12:34:12 PM UTC+8, Brian Becker wrote: After upgrading to 1.8.5 (from 1.8.1) I instantly had Internal Server Error whenever my class was instantiated and placed in memcache: daRef = oRefFinder() memcache.set( 'theRef', daRef) The last lines of the error trace says that the memcache.set command: File "/base/data/home/apps/s~refindservice/1.370602298270267557/main.py", line 117, in get memcache.set('theRef' , daRef ) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/memcache/__init__.py", line 763, in set namespace=namespace) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/memcache/__init__.py", line 868, in _set_with_policy time, '', namespace) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/memcache/__init__.py", line 947, in _set_multi_async_with_policy stored_value, flags = _validate_encode_value(value, self._do_pickle) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/memcache/__init__.py", line 227, in _validate_encode_value stored_value = do_pickle(value) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/memcache/__init__.py", line 392, in _do_pickle pickler.dump(value) TypeError: 'NoneType' object is not callable I finally traced it to __setattr__ and __getattr__. If I go into my class and change __setattr__ and __getattr__ methods to something else like tabooset and tabooget -- Memcache error goes away. GRRRR. If I delete all the content in my __setattr__ and just put "pass" -- it still bombs -- so this is specific to the name of those methods. First, what is going on? Second, is there some other way I'm supposed to be setting and getting attributes in my classes in GAE? And yes, this was operating fine before I upgraded from 1.8.1 to 1.8.5. Brian -- You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/2d9UO1m0wV8/unsubscribe. To unsubscribe from this group and all its topics, send an email to google-appeng...@googlegroups.com<mailto:google-appeng...@googlegroups.com>. To post to this group, send email to google-...@googlegroups.com<mailto:google-...@googlegroups.com>. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/2d9UO1m0wV8/unsubscribe. To unsubscribe from this group and all its topics, send an email to google-appeng...@googlegroups.com<mailto:google-appeng...@googlegroups.com>. To post to this group, send email to google-...@googlegroups.com<mailto:google-...@googlegroups.com>. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/2d9UO1m0wV8/unsubscribe. To unsubscribe from this group and all its topics, send an email to google-appeng...@googlegroups.com<javascript:>. To post to this group, send email to google-...@googlegroups.com<javascript:>. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/2d9UO1m0wV8/unsubscribe. To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscr...@googlegroups.com<mailto:google-appengine+unsubscr...@googlegroups.com>. To post to this group, send email to google-appengine@googlegroups.com<mailto:google-appengine@googlegroups.com>. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.