Skip to content

FileNotFoundError: [Errno 2] No such file or directory (file_size = os.stat(download_path).st_size) #338

@GuusDeGraeve

Description

@GuusDeGraeve

Overview

Script suddenly crashes on photos of a specific type (whitagram). After downloading hundreds of photos, the script suddenly crashes (and keeps crashing) on a specific photo created with the Whitagram app (an app that adds white borders around the photo). I think it occurs when you have size set to "medium" and specifically when a version of the file does not have a medium size or something? It seems to only happen with these Whitagram photos, when I try to remove this photo from iCloud, it just crashes at the next Whitagram photo.

2021-05-31 14:42:02 INFO     Skipping IMG_1569.MOV, only downloading photos.
2021-05-31 14:42:02 INFO     Skipping IMG_1568.MOV, only downloading photos.
2021-05-31 14:42:02 INFO     Skipping 2fc5f66422a34dca9406da918aedbfd5.mov, only downloading photos.
2021-05-31 14:42:02 INFO     /data/icloud/import/XXX/2020/10/11/Whitagram-Image-medium.jpg already exists.
Traceback (most recent call last):
  File "/usr/bin/icloudpd", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/icloudpd/base.py", line 562, in main
    download_photo(consecutive_files_found, item)
  File "/usr/lib/python3.8/site-packages/icloudpd/base.py", line 456, in download_photo
    file_size = os.stat(download_path).st_size
FileNotFoundError: [Errno 2] No such file or directory: '/data/icloud/import/XXX/2020/10/11/Whitagram-Image.jpg'

Steps to Reproduce

  1. Use whitagram to edit a photo and save it to your library.
  2. Run the icloudpd script
  3. Wait for the error to occur.

Expected Behavior

The script should not crash in this case, and even if a photo fails, I think it should be catched and just skip the photo to continue with the next one.

Actual Behavior

The script completely crashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions