Python error "IOError: [Errno 2] No such file or directory" but file is there
I am trying to read a csv file and I am getting the error above but the file is there. The line giving the error is
infilequery = file('D:\x88_2.csv','rb')
and I get the error below.
Traceback (most recent call last): File "C:\Python26\usrapply_onemol2.py", line 14, in infilequery = file('D:\x88_2.csv','rb') IOError: [Errno 2] No such file or directory: 'D:\x88_2.csv'
I can put a file from the same directory in its place and python at least sees it. The result of os.listdir("D:") features 'x88_2.csv' and the result of "dir D:\" also includes it. When putting the filename in and allowing python to complete the path and selecting x88_2.csv from the dropdown, I still get the same error. What is up he开发者_运维百科re?
Try
'D:\\x88_2.csv'
The \x88
is interpreted as the character at code point 0x88. Alternatively you could use raw string
r'D:\x88_2.csv'
or forward slash
'D:/x88_2.csv'
精彩评论