icloud_photos_downloader: albumNameEnc error?

Hello, I just did a fresh install of windows 10, I also tried this on centos. Both give the same error bellow:

Traceback (most recent call last):
  File "icloudpd.py", line 5, in <module>
    main()
  File "C:\Users\Provision\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Provision\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\Provision\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Provision\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Provision\Desktop\icloud_photos_downloader-master\icloudpd\base.py", line 276, in main
    photos = icloud.photos.albums[album]
  File "C:\Users\Provision\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyicloud_ipd\services\photos.py", line 194, in albums
    folder['fields']['albumNameEnc']['value']).decode('utf-8')
KeyError: 'albumNameEnc'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@DeastinY I have tried your workaround, you seem to have an issue there. Trying with your suggestion leads to an Syntax Error. But i got it working:

try:                   
    folder_name = base64.b64decode(
        folder['fields']['albumNameEnc']['value']).decode('utf-8')
except KeyError:              
    continue

Thanks @Vlad1mir-D! I merged your PR and released a new version of icloudpd: 1.6.1. Please try that out and let me know if it fixes the issue

Are there any plans to create a pull request for this fix?

While I don’t know the origin of the error a fix is rather simple: Open "/usr/local/lib/python3.7/site-packages/pyicloud_ipd/services/photos.py", line 194 and change it from folder['fields']['albumNameEnc']['value']).decode('utf-8') to

try:
    folder['fields']['albumNameEnc']['value']).decode('utf-8')
except KeyError:
    continue

this will skip the folder with the bad name.

Heyho, the script checks for ‘----Root-Folder----’

if folder['recordName'] == '----Root-Folder----' or \

Within my data there was ‘----Project-Root-Folder----’ as well. With e.g.:

if folder['recordName'] == '----Project-Root-Folder----' or folder['recordName'] == '----Root-Folder----' or \

it works for me.

Regards

I’d be interested in a fix for this, however, there isn’t a “fix” as yet, is there?

It was my understanding that the workaround detailed here, only skips the files that present the problem, rather than provide a solution which enables their download.

While I don’t know the origin of the error a fix is rather simple: Open "/usr/local/lib/python3.7/site-packages/pyicloud_ipd/services/photos.py", line 194 and change it from folder['fields']['albumNameEnc']['value']).decode('utf-8') to

try:
    folder['fields']['albumNameEnc']['value']).decode('utf-8')
except KeyError:
    continue

this will skip the folder with the bad name.