basnijholt / instacron

📸 Instagram for the lazy - automatically upload a photo to Instagram
MIT License
20 stars 5 forks source link

IndexError: Cannot choose from an empty sequence #10

Open roncam82 opened 5 years ago

roncam82 commented 5 years ago

can you help me on the above error please ?

basnijholt commented 5 years ago

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

roncam82 commented 5 years ago

But I have photos in the folder

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


From: Bas Nijholt notifications@github.com 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.

basnijholt commented 5 years ago

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.

roncam82 commented 5 years ago

yes they are .jpg

they need to be in a particular filename ?

basnijholt commented 5 years ago

Are they in a folder called photos?

roncam82 commented 5 years ago

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

basnijholt commented 5 years ago

Could you post the entire error message?

roncam82 commented 5 years ago

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

basnijholt commented 5 years ago

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?

roncam82 commented 5 years ago

need to be of a particular size ? ratio ?

roncam82 commented 5 years ago

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 commented 5 years ago

i think there is something in the api_photo.py

JWPapi commented 5 years ago

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"