Oh yes.
You call os.path.isfile(f) , where f is the name of the file in path . You will need to specify an absolute path. If, indeed, this call is necessary (it should always return True ).
Try changing your for loop to:
qualified_filenames = (os.path.join(path, filename) for filename in fnames) for f in qualified_filenames:
And you must be installed!
In addition, os.chdir() calls os.chdir() not needed.
And, as I suggested in the comments, filterfiles should look like this:
def filterfiles(f): ext = os.path.splitext(f)[1][1:] return ext in fileFilter
(You missed return ).
Johnsyweb
source share