[EMAIL PROTECTED] wrote:

> 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?

nothing, from what I can tell.

did you verify that the code you posted really have the problem (it does 
use the 'os' module which isn't important, and doesn't use 'glob' which 
is imported, so chances are that you messed something up on the way to 
comp.lang.python).

what do you get if you add

     print repr(pat), type(pat)

just before the list comprehension ?

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to