zackmawaldi / YouTube-shorts-generator

Automatically download Reddit videos, edit them, and upload them to YouTube.
MIT License
323 stars 62 forks source link

Line 34 Error #1

Closed obaid56 closed 1 year ago

obaid56 commented 2 years ago

Traceback (most recent call last): File "/Users/user/Downloads/YouTube-shorts-generator-main/main.py", line 34, in os.rename(directory + os.listdir(directory)[0], directory + "main_clip.mp4") IndexError: list index out of range

zackmawaldi commented 2 years ago

The way this line is supposed to work is as follows:

os.rename takes old directory of file, and places it in new directory with new name.

directory + os.listdir(directory)[0] ==temp_clips/[name of file downloaded using redvid, as it's first item in the directory] directory + "main_clip.mp4" == temp_clips/main_clip.mp4

If you're getting indexError, this isn't due to directory not existing, per os.rename documentation.

This means issue is probably within downloading reddit video. It's either from praw not giving correct url to redvid, or redvid is not working correctly. Make sure config.py is configured correctly. If you think it's a bug in the code, lmk how I can replicate it!

Hope that helped, Zack.