In <[EMAIL PROTECTED]>, custard_pie
wrote:

> Here's my code
> ========================================================
> filelist={}
> def listFiles(self, dirName, filesInDir):
>       for fname in filesInDir:
>               if os.path.isfile(fname):

`fname` contains just the file name without the path to the file.  So this
gives `False` for every file name except if there's a file with the same
name in the current working directory.

>                       key = os.path.join(dirName, fname)
>                       stats = os.stat(fname)

Same problem with `stat()`.  Move the assignment to `key` up and use that
to check with `isfile()`/`isdir()` and `stat()`.

>                       filelist[key] = (stats[stat.ST_MTIME], 
> stats[stat.ST_SIZE])
> os.path.walk(string.strip(self.path.get()), listFiles, None)
> print filelist
> =======================================================

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to