Closed obaid56 closed 1 year 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.
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