By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,957 Members | 2,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,957 IT Pros & Developers. It's quick & easy.

problems with opening files due to file's path

P: n/a

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.
View this message in context:
Sent from the Python - python-list mailing list archive at

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.