Possible Duplicate:
IOError when trying to open existing files
I'm having problems opening a file with open() in python 3.3, any idea why?
I'm trying
import os
filelist = [ f for f in os.listdir( os.curdir )]
singleFile = filelist[a]
hppfile = open(singleFile, 'r')
And I get
FileNotFoundError: [Errno 2] No such file or directory: '-file that is actually inside the directory-'
Ideas?
On Windows, I just started this to learn this to write few quick scripts
os.listdir()returns a filename, not a full path.os.listdir()already returns a list, and the default argument is alreadyos.curdirbtw. But I cannot reproduce this problem with files in the current directory, so I suspect your code sample does not match your real code.