pyicloud: TypeError: 'dict_values' object does not support indexing
Peter Otten
__peter__ at web.de
Fri Sep 30 09:52:14 EDT 2016
Adam Funk wrote:
> I'm trying to use pyicloud in idle3 (installed by pip3 on Ubuntu).
>
> <https://github.com/picklepete/pyicloud>
>
> The basic stuff works, but access to photos (following the
> instructions) fails:
>
>
>>>> photos = api.photos.all
>>>> for photo in photos:
> print(photo.filename)
>
>
> Traceback (most recent call last):
> File "<pyshell#37>", line 2, in <module>
> print(photo.filename)
> File
> "/usr/local/lib/python3.5/dist-packages/pyicloud/services/photos.py",
> line 242, in filename
> return self.data['details'].get('filename')
> File
> "/usr/local/lib/python3.5/dist-packages/pyicloud/services/photos.py",
> line 237, in data
> self._data = self.album._fetch_asset_data_for(self)
> File
> "/usr/local/lib/python3.5/dist-packages/pyicloud/services/photos.py",
> line 203, in _fetch_asset_data_for
> client_ids.append(self._photo_assets[index].client_id)
> TypeError: 'dict_values' object does not support indexing
>
> which points at this bit of the source code
>
> 240 @property
> 241 def filename(self):
> 242 return self.data['details'].get('filename')
>
> And I get the same exception trying to do anything with a single
> photo. Is this code not really Python 3 compatible? Or am I doing
> something stupid?
I don't think you are. Try wrapping the return value of
def _parse_binary_feed(self, feed):
...
return list(assets.values())
in services/photos.py to convert the view into a list.
Of course when there's one problem there will likely be more...
More information about the Python-list
mailing list