Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > problems with opening files due to file's path

Thread Tools

problems with opening files due to file's path

Posts: 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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
os.path.walk() to get full path of all files dude Python 5 03-17-2011 09:09 AM
Fixing Ant build that fails due to space in path eran Java 6 08-08-2008 08:43 PM
Re: problems with opening files due to file's path Alexnb Python 31 06-11-2008 10:36 PM
How to due with "warning LNK4075: ignoring '/INCREMENTAL' due to Fresh C++ 2 04-22-2008 09:03 PM
Kodak EasyShare can't find photos due to bad path Doug Clemens Digital Photography 3 01-12-2004 05:35 PM