instacron icon indicating copy to clipboard operation
instacron copied to clipboard

IndexError: Cannot choose from an empty sequence

Open roncam82 opened this issue 7 years ago • 13 comments

can you help me on the above error please ?

roncam82 avatar Jan 20 '19 14:01 roncam82

That means that instacron can't find any photos in the photos folder.

basnijholt avatar Jan 20 '19 14:01 basnijholt

But I have photos in the folder

Get Outlook for Androidhttps://aka.ms/ghei36


From: Bas Nijholt [email protected] Sent: Sunday, January 20, 2019 3:49:46 PM To: basnijholt/instacron Cc: roncam82; Author Subject: Re: [basnijholt/instacron] IndexError: Cannot choose from an empty sequence (#10)

That means that instacron can't find any photos in the photos folder.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/basnijholt/instacron/issues/10#issuecomment-455872652, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsLNQ0vDcqxt_bYTXbVFJ3Uvylj93EPEks5vFIIKgaJpZM4aJqy7.

roncam82 avatar Jan 20 '19 14:01 roncam82

I'm not near my computer but looking at the code, all the photos must be .jog with the lower case .jpg so NOT .JPG.

basnijholt avatar Jan 20 '19 14:01 basnijholt

yes they are .jpg

they need to be in a particular filename ?

roncam82 avatar Jan 20 '19 14:01 roncam82

Are they in a folder called photos?

basnijholt avatar Jan 20 '19 14:01 basnijholt

yes: C:\Users\Administrator\Documents\GitHub\instacron\photos

roncam82 avatar Jan 20 '19 14:01 roncam82

Could you post the entire error message?

basnijholt avatar Jan 20 '19 14:01 basnijholt

if i have .jpg photo in the folder the output is:

C:\Users\Administrator\Documents\GitHub\instacron>python instacron.py Traceback (most recent call last): File "instacron.py", line 374, in main() File "instacron.py", line 352, in main pic = fix_photo(photo) File "instacron.py", line 279, in fix_photo if not correct_ratio(photo): File "instacron.py", line 58, in correct_ratio return compatible_aspect_ratio(get_image_size(photo)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\instabot\api\api_photo.py", line 145, in get_image_size raise RuntimeError("Unsupported format") RuntimeError: Unsupported format

if i rename .jpg photo to .jpeg in the folder the output is:

C:\Users\Administrator\Documents\GitHub\instacron>python instacron.py Traceback (most recent call last): File "instacron.py", line 374, in main() File "instacron.py", line 348, in main photo = choose_random_photo(uploaded_file, photo_folder) File "instacron.py", line 71, in choose_random_photo photo = random.choice(photos) # choose a random photo File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\random.py", line 261, in choice raise IndexError('Cannot choose from an empty sequence') from None IndexError: Cannot choose from an empty sequence

roncam82 avatar Jan 20 '19 14:01 roncam82

if i rename .jpg photo to .jpeg in the folder the output is:

You shouldn't do that.

Now the problem is that your jpeg files are corrupted. Did you try it with a different photo like I suggested earlier?

basnijholt avatar Jan 20 '19 15:01 basnijholt

need to be of a particular size ? ratio ?

roncam82 avatar Jan 20 '19 15:01 roncam82

tried different photo now same:

C:\Users\Administrator\Documents\GitHub\instacron>python instacron.py Traceback (most recent call last): File "instacron.py", line 374, in main() File "instacron.py", line 352, in main pic = fix_photo(photo) File "instacron.py", line 279, in fix_photo if not correct_ratio(photo): File "instacron.py", line 58, in correct_ratio return compatible_aspect_ratio(get_image_size(photo)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\instabot\api\api_photo.py", line 145, in get_image_size raise RuntimeError("Unsupported format") RuntimeError: Unsupported format

roncam82 avatar Jan 20 '19 15:01 roncam82

i think there is something in the api_photo.py

roncam82 avatar Jan 20 '19 15:01 roncam82

for me changing it to jpg works. just used some testpics. however Now I'm having the next error. Gonna figure it out tho. It's saying KeyError:"Image Make"

JWPapi avatar Sep 07 '19 04:09 JWPapi