Hi,
I tried to SearchCommunityPhotos but encounter a Error: (very often)
In [22]: ps=service.SearchCommunityPhotos('apple')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
/home/tick/work/dabajianshan/<ipython console> in <module>()
/home/tick/work/dabajianshan/gdata/photos/service.pyc in
SearchCommunityPhotos(self, query, limit)
283 """
284 uri='/data/feed/api/all?q=%s' % query
--> 285 return self.GetFeed(uri, limit=limit)
286
287 def GetContacts(self, user='default', limit=None):
/home/tick/work/dabajianshan/gdata/photos/service.pyc in GetFeed(self,
uri, limit, start_index)
175 uri += '&start-index=%s' % start_index
176 try:
--> 177 return self.Get(uri,
converter=gdata.photos.AnyFeedFromString)
178 except gdata.service.RequestError, e:
179 raise GooglePhotosException(e.args[0])
/home/tick/work/dabajianshan/gdata/service.pyc in Get(self, uri,
extra_headers, redirects_remaining, encoding, converter)
988 if server_response.status == 200:
989 if converter:
--> 990 return converter(result_body)
991 # There was no ResultsTransformer specified, so try to
convert the
992 # server's response into a GDataFeed.
/home/tick/work/dabajianshan/gdata/photos/__init__.pyc in
AnyFeedFromString(xml_string)
1074 if category is None:
1075 # TODO: is this the best way to handle this?
-> 1076 return atom._CreateClassFromElementTree(GPhotosBaseFeed,
tree)
1077 namespace, kind = category.get('term').split('#')
1078 if namespace != PHOTOS_NAMESPACE:
/home/tick/work/dabajianshan/atom/__init__.py in
_CreateClassFromElementTree(target_class, tree, namespace, tag)
127 if tree.tag == '{%s}%s' % (namespace, tag):
128 target = target_class()
--> 129 target._HarvestElementTree(tree)
130 return target
131 else:
/home/tick/work/dabajianshan/atom/__init__.py in _HarvestElementTree
(self, tree)
145 # Fill in the instance members from the contents of the
XML tree.
146 for child in tree:
--> 147 self._ConvertElementTreeToMember(child)
148 for attribute, value in tree.attrib.iteritems():
149 self._ConvertElementAttributeToMember(attribute, value)
/home/tick/work/dabajianshan/gdata/photos/__init__.pyc in
_ConvertElementTreeToMember(self, child_tree)
145 if category is None:
146 return atom.AtomBase._ConvertElementTreeToMember(self,
child_tree)
--> 147 namespace, kind = category.get('term').split('#')
148 if namespace != PHOTOS_NAMESPACE:
149 return atom.AtomBase._ConvertElementTreeToMember(self,
child_tree)
AttributeError: 'NoneType' object has no attribute 'split'
And I create the following patch to ease this issue, however
I am sure root cause is in some where else.
-------------------------- gdata/photos/__init__.py
---------------------------
index 1952135..e667d92 100644
@@ -144,7 +144,11 @@ class GPhotosBaseFeed(gdata.GDataFeed,
gdata.LinkFinder):
category = child_tree.find('{%s}category' % atom.ATOM_NAMESPACE)
if category is None:
return atom.AtomBase._ConvertElementTreeToMember(self,
child_tree)
- namespace, kind = category.get('term').split('#')
+ term = category.get('term')
+ if term == None:
+ return atom.AtomBase._ConvertElementTreeToMember(self,
child_tree)
+ else:
+ namespace, kind = term.split('#')
if namespace != PHOTOS_NAMESPACE:
return atom.AtomBase._ConvertElementTreeToMember(self,
child_tree)
## TODO: is it safe to use getattr on gdata.photos?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---