attribute error using fnmatch

s99999999s2003 at yahoo.com s99999999s2003 at yahoo.com
Mon Jun 5 08:42:31 CEST 2006


hi
i have script like this:

from fnmatch import fnmatch
from glob import glob
....
...
f = ['file1','file2','file3']
r = "d:\\somepath"
pat = "*.bat"
listof_files = [i for i in f if not fnmatch(os.path.join(r,i),pat) and
os.path.isfile(os.path.join(r,i))]
...
..

I get  this error:
  File "C:\Python24\Lib\fnmatch.py", line 37, in fnmatch
    pat = os.path.normcase(pat)
  File "C:\Python24\lib\ntpath.py", line 42, in normcase
    return s.replace("/", "\\").lower()
AttributeError: replace

But when i do everything in interactive, there is no problem.. What
could be wrong with the script?
My purpose is to find a list of files that does not match pat...
thanks




More information about the Python-list mailing list