Raw Strings (I Think)
Lanny
lanny at freshells.ch
Thu Jul 24 11:56:44 EDT 2008
> my guess is that the real problem is that you get back filenames with
> spaces in them, which gets treated as multiple arguments by os.system.
>
> using os.startfile will fix this:
>
> >>> import glob, os, random
> >>> file = random.choice(glob.glob("\\music\\*.mp3"))
> >>> file
> '\\music\\Madrugada - Grit - 05 - Seven Seconds.mp3'
> >>> print file
> \music\Madrugada - Grit - 05 - Seven Seconds.mp3
> >>> os.system(file)
> '\music\Madrugada' is not recognized as an internal or external command,
> operable program or batch file.
> 1
> >>> os.startfile(file)
> ... music starts playing ...
>
> </F>
Thanks I just switched the startfile for system and it worked like a charm
Thanks
-- Posted on news://freenews.netfront.net - Complaints to news at netfront.net --
More information about the Python-list
mailing list