0

I have a file with the following path :

D:/bar/クレイジー・ヒッツ!/foo.abc

I am parsing the path from a XML file and storing it in a variable called "path" in the form of "file://localhost/D:/bar/クレイジー・ヒッツ!/foo.abc"
Then, the following operations are being done :

path=path[17:]  #to remove the file://localhost/   part from the path
            path=urllib.url2pathname(path)
            path=path.decode('utf8') '''to properly encode the path in case it has non-english characters'''

Now, when I run this code, I get the following error

IOError: [Errno 2] No such file or directory: u'D:\\Music\\Pink Floyd\\The Wall Disc 1\\5 - Another Brick in the Wall, Pt. 2.mp3'

I am using Python 2.7 on Windows 7

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by vegaseat
0

Spaces in folder and file names create problems with Windows ...

# the Microsoft kludge, quoting a string within a string fixes the 
# space-in-folder-name problem, tells the OS to use the whole string
# including spaces as a single command
# (make sure filename does not contain any spaces!)
path = '"C:/Program Files/IrfanView/i_view32.exe" ' + filename
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.