icloud-photos-downloader / icloud_photos_downloader

A command-line tool to download photos from iCloud
MIT License
6.92k stars 556 forks source link

IndexError: Replacement index 1 out of range for positional args tuple #937

Closed pipe-organ closed 3 months ago

pipe-organ commented 3 months ago

Password and 2FA works perfectly and I have iCloud Web access enabled . But it fails with these error messages. Any idea what I am doing wrong here? Thanks in advance!!

Launch

root@podman:~# podman run -it --rm --name icloudpd -v /mnt/photos/Photo_Incoming:/data -e TZ=America/Los_Angeles icloudpd/icloudpd:latest icloudpd --directory /data --username _my_email_@gmail.com --watch-with-interval 3600 --folder-structure {:%Y}/{:%Y-%m-%d}

Running latest

root@podman:~# podman pull icloudpd/icloudpd:latest                                                                                                  
Trying to pull docker.io/icloudpd/icloudpd:latest...
Getting image source signatures
Copying blob fa52739195da skipped: already exists  
Copying blob 9129e9240bcd skipped: already exists  
Copying blob f6abdc93b500 skipped: already exists  
Copying blob 0fffb38349d6 skipped: already exists  
Copying blob 4f4fb700ef54 skipped: already exists  
Copying blob 930bdd4d222e skipped: already exists  
Copying config 6c39b134f9 done  
Writing manifest to image destination

Error Message

2024-08-22 00:17:15 INFO     Great, you're all set up. The script can now be run without user interaction until 2FA expires.
You can set up email notifications for when the two-factor authentication expires.
(Use --help to view information about SMTP options.)
2024-08-22 00:17:17 DEBUG    Looking up all photos and videos from album All Photos...
2024-08-22 00:17:17 INFO     Downloading 1152 original photos and videos to /data ...                                                                
  0%|                                                                                                                       | 0/1152 [00:00<?, ?it/s]Traceback (most recent call last):
  File "starters/icloudpd_ex.py", line 122, in <module>
  File "starters/icloudpd_ex.py", line 118, in main
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "icloudpd/base.py", line 738, in main
  File "icloudpd/base.py", line 1333, in core
  File "icloudpd/base.py", line 841, in download_photo_
IndexError: Replacement index 1 out of range for positional args tuple
[2] Failed to execute script 'icloudpd_ex' due to unhandled exception!
root@podman:~#           
AndreyNikiforov commented 3 months ago

I suspect that --folder-structure {:%Y}/{:%Y-%m-%d} is the issue. {} selects parameter and only one parameter is passed to formatting function, but your formatting string asks for two. You can use --folder-structure {:%Y/%Y-%m-%d} instead.

This is a way to test formatting in any online python interpreter:

import datetime 
print('{:%Y/%Y-%m-%d}'.format(datetime.datetime.now()))

prints:

2024/2024-08-22
pipe-organ commented 3 months ago

Ah! I see. Thank you so much for taking a look Andrey!! I'll try again.

pipe-organ commented 3 months ago

You corrections are working perfectly. Thanks again for the help!!!! I''ll close it now.