Newbie Question

Bob W. removethis_kranki2 at earthlink.net
Fri Dec 22 10:38:32 EST 2000


I tried using "self" in the os.path.walk and I get an error saying
that there 3 expected arguments, but got 4 in ntpath.py, line 264.
That was my preferred way of simulating a C++ private method.
Thanks for any help provided!

On Fri, 22 Dec 2000 13:44:23 GMT, Bob W.
<removethis_kranki2 at earthlink.net> wrote:

>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