After searching pretty extensively for examples/solutions to my coding problem and finding a few related answers, nothing has helped get my script working. I'm hoping maybe someone can offer some direct advice. Basically I'm trying to write a script that chooses a random video file from a folder on my desktop, and then plays the file that it has chosen. So far my script will select a random video file, but instead of playing it I get an "IOError: [Errno 2] No such file or directory" message. The following code is what I have so far:
import os, random
episode = random.choice(os.listdir("C:\Users\Spaul\desktop\PythonHard\SP"))
open(episode)
print "\nThe current path is %s\n" % (episode)
Thanks for any and all help on this one.
Aucun commentaire:
Enregistrer un commentaire