problems with opening files due to file's path

Discussion in 'Python' started by Alexnb, Jun 10, 2008.

  1. Alexnb

    Alexnb Guest

    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's-path-tp17759531p17759531.html
    Sent from the Python - python-list mailing list archive at Nabble.com.
    Alexnb, Jun 10, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim
    Replies:
    0
    Views:
    299
  2. Fresh
    Replies:
    2
    Views:
    634
    Bo Persson
    Apr 22, 2008
  3. Alexnb
    Replies:
    31
    Views:
    781
    Ethan Furman
    Jun 11, 2008
  4. eran
    Replies:
    6
    Views:
    693
    Gilbert Rebhan
    Aug 8, 2008
  5. \A_Michigan_User\

    Various path/path/files.asp all #include this 1 file

    \A_Michigan_User\, Jul 10, 2005, in forum: ASP General
    Replies:
    1
    Views:
    230
    Jeff Cochran
    Jul 10, 2005
Loading...

Share This Page