problems with opening files due to file's path

Alexnb alexnbryan at gmail.com
Tue Jun 10 12:28:35 EDT 2008


Okay, so what I want my program to do it open a file, a music file in
specific, and for this we will say it is an .mp3. Well, I am using the
system() command from the os class. The problem I am running into is that
when I send the path of the file to the system() command, which for those of
you who don't know the system command is the equivalent of typing one
command into command prompt or terminal depending on your system. But let's
say that the file is "C:\Music\01 - Track.mp3" or something like that where
the number 0 is next to the backslash. Another example is this
"C:\Music\track(single)\Track.mp3" The problem here is that the ")" at the
end of the single, is conflicting with the backslash as well. Now here is
the exact code I was trying to do and when I run it I get false returned. 

system("\"C:\Documents and Settings\Alex\My Documents\My
Music\Rhapsody\Bryanbros\Weezer\(2001)\04 - Island In The Sun.wma\"")

Okay, now as you can see it sends it to the system with quotes "\"" and
works if I change the file path and get rid of the "04" and the ")" it
works, so that is the problem no doubt. If anyone has a way to do this
please let me know, or even another way to open a music file like this.
Help?
-- 
View this message in context: http://www.nabble.com/problems-with-opening-files-due-to-file%27s-path-tp17759531p17759531.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list