`--xmp-sidecar` + `--only-print-filenames` crashes with FileNotFoundError

Author: rolemeCreated Jul 10, 2026Updated Aug 28, 2026

Running 1.32.3. If you pass both --xmp-sidecar and --only-print-filenames, icloudpd crashes:

File "icloudpd/xmp_sidecar.py", line 75, in generate_xmp_file
FileNotFoundError: [Errno 2] No such file or directory: '.../IMG_xxxx.HEIC.xmp'

Makes sense — in print-only mode nothing is downloaded so the target folder is never created, but the sidecar writer still tries to open the .xmp there. The dry_run path is guarded, but --only-print-filenames isn't, so it slips through.

Repro:

icloudpd --directory /tmp/t --cookie-directory /config --username <user> --recent 2 --xmp-sidecar --only-print-filenames

Would expect sidecar generation to just be skipped in print-only mode (same as the download is). Happy to test a fix.

Source: icloud-photos-downloader/icloud_photos_downloader