En Thu, 24 Jul 2008 12:02:00 -0300, Lanny <[EMAIL PROTECTED]> escribió:
> I've used glob.glob to get a list of files in a directory
> and now I want to use os.system to execute one of
> those files, the problem is that python automatically
> puts a escape charater infront of the back slashes
> so
> 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\\Madr
Lanny wrote:
No, it doesn't. Instead of guessing what the cause might be, please show
us your code and show us the error message you're getting, so that we can
determine what the cause really is.
Ok, sorry. Heres my code:
> [...]
And the error message you're getting is...?
--
Carsten Haese
Lanny wrote:
No, it doesn't. Instead of guessing what the cause might be, please show
us your code and show us the error message you're getting, so that we can
determine what the cause really is.
Ok, sorry. Heres my code:
import glob
import random
import os
songs = glob.glob('C:\###\###\###
> No, it doesn't. Instead of guessing what the cause might be, please show
> us your code and show us the error message you're getting, so that we can
> determine what the cause really is.
Ok, sorry. Heres my code:
import glob
import random
import os
songs = glob.glob('C:\###\###\###\*.mp3')
p
Lanny wrote:
I've used glob.glob to get a list of files in a directory
and now I want to use os.system to execute one of
those files, the problem is that python automatically
puts a escape charater infront of the back slashes
so the os.system gets X:\\\\\\ and is useless,
No, it doesn'
Lanny wrote:
I've used glob.glob to get a list of files in a directory
and now I want to use os.system to execute one of
those files, the problem is that python automatically
puts a escape charater infront of the back slashes
No, it doesn't. Instead of guessing what the cause might be, please s
On Jul 24, 10:02 am, "Lanny" <[EMAIL PROTECTED]> wrote:
> I've used glob.glob to get a list of files in a directory
> and now I want to use os.system to execute one of
> those files, the problem is that python automatically
> puts a escape charater infront of the back slashes
> so the os.system get
I've used glob.glob to get a list of files in a directory
and now I want to use os.system to execute one of
those files, the problem is that python automatically
puts a escape charater infront of the back slashes
so the os.system gets X:\\\\\\ and is useless,
I think I need to convert my st