Skip to content

Intermittent Crash with --xmp-sidecar Flag When Downloading Edited Photos #1056

@UnoSee

Description

@UnoSee

Overview

When using the --xmp-sidecar flag in icloudpd, the program intermittently crashes when processing certain edited photos. The crash results in a JSON decoding error, halting the download process and requiring manual intervention.

Steps to Reproduce

  1. Use the --xmp-sidecar flag when running icloudpd.
  2. Include a mix of edited and unedited photos in the download.
  3. Observe that the program crashes intermittently when encountering certain edited photos.

Expected Behavior

The program should process all photos, including edited ones, without crashing and generate valid XMP sidecar files.

Actual Behavior

The program crashes with the following traceback:

Traceback (most recent call last):
  File "starters\icloudpd.py", line 6, in <module>
  File "click\core.py", line 1161, in __call__
  File "click\core.py", line 1082, in main
  File "click\core.py", line 1443, in invoke
  File "click\core.py", line 788, in invoke
  File "icloudpd\base.py", line 767, in main
  File "icloudpd\base.py", line 1376, in core
  File "icloudpd\base.py", line 989, in download_photo_
  File "icloudpd\xmp_sidecar.py", line 69, in generate_xmp_file
  File "icloudpd\xmp_sidecar.py", line 91, in build_metadata
  File "json\__init__.py", line 346, in loads
  File "json\decoder.py", line 345, in decode
  File "json\decoder.py", line 363, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[PYI-4468:ERROR] Failed to execute script 'icloudpd' due to unhandled exception!

Context

This bug is particularly disruptive because it makes unattended downloads impossible. I have to monitor logs constantly to ensure the program hasn't crashed, and when it does, I need to take manual steps to continue the download.

Workarounds

  • If the photo is not important, I delete the edited version before running icloudpd again.
  • If the photo is important, I revert it to its original version before resuming the download.

Both workarounds require constant attention and are inefficient.

This issue seems specific to some edited photos, as not all of them trigger the crash.

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