Newbie Question

Emile van Sebille emile at fenx.com
Fri Dec 22 15:33:36 CET 2000


Do you intend to be invoking the unbound class method?  Or
should

os.path.walk( self.szDir, RmwExpireCheck.__CheckFile, self )

be

os.path.walk( self.szDir, self.__CheckFile, self )

--

Emile van Sebille
emile at fenx.com
-------------------


"Bob W." <removethis_kranki2 at earthlink.net> wrote in message
news:05m64tkqev0aavea80ttjse1sj2gd447hg at 4ax.com...
> 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