I'm trying to find the name of the most recently created file in a directory:
    try:
        #print "creating path"
        os.makedirs(self.path)
        self.dictName = "0"
    except OSError as exception:
        if exception.errno != errno.EEXIST:
            raise
        listOfFiles = os.listdir(self.path)
        listOfFiles = filter(lambda x: not os.path.isdir(x), listOfFiles)
        print "creating newestDict"
        newestDict = max(listOfFiles, key=lambda x: os.stat(x).st_mtime) ------<
        print "setting self.name"
The arrow points where the code is causing the program to crash. Printing listOfFiles returns a non-empty list. This is using a third-party python program that has its own interpreter. Any ideas what I'm doing wrong? Thanks!
 
     
    