Newbie Question

Bob W. removethis_kranki2 at earthlink.net
Fri Dec 22 08:44:23 EST 2000


I am trying to write the following class, but it fails in the Run()
method reference to __CheckFile and I am not sure how to get it to
work.  Thanks in advance for your help!

class RmwExpireCheck:
    def __init__( self, szFileName, szDir ):
        self.szFileName = szFileName
        FileStatList = os.stat( szFileName )
        if FileStatList:
            self.iCheckDate = FileStatList[8]
        self.szDir = szDir
        self.szFileList = []

    def __getitem__(self, i):
        line = self.szFileList[i]
        if line:
            return line
        else:
            raise IndexError

    def __CheckFile( self, szDirName, szFileNames ):
        for szFileName in szFileNames:
            szPathName = os.path.join( szDirName, szFileName )
            if os.path.isfile( szPathName ):
                iFileTime = os.stat( szPathName )[8]
                if iFileTime > self.iCheckDate:
                    self.szFileList.append( szPathName )
        
    def Run( self ):
        os.path.walk( self.szDir, RmwExpireCheck.__CheckFile, self )
        





More information about the Python-list mailing list