I'm using this method to pick random files of a certain type from a folder a user inputs, and then concentate them together in MoviePy:
filename = glob.glob(input +"/*.mp3")
sdofjsodfj = random.choice(filename)
aclips.append(AudioFileClip(sdofjsodfj))
random.shuffle(aclips)
filename = glob.glob(input + "/*.mp4")
clipname = random.choice(filename)
lend = random.uniform(.5, VideoFileClip(clipname).duration)
end = clipname
finalclip = VideoFileClip(end).subclip(lend - .5, lend).fx(vfx.speedx, random.uniform(.54, 3)).resize((250, 250))
However, this method sometimes works, but most of the time returns this error:
IndexError: Cannot choose from an empty sequence
Is there a reason why it would be doing this?