[EMAIL PROTECTED] kirjoitti: > On Feb 27, 12:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >> wrote: >> >>> File "./scripts/regressionTest.py", line 30, in getSnapShot >>> if (difflib.context_diff(f1.readlines(), f2.readlines()).len() == >>> 0): >>> # no difference >>> else: >>> # files are different >>> AttributeError: 'generator' object has no attribute 'len' >>> Can you please help? >> The function returns a generator/iterator over the differences which has >> no `len()` method. If you just want to know if two files are equal or not >> use `filecmp.cmp()`. Read the docs about the `shallow` argument of that >> function. >> >> Ciao, >> Marc 'BlackJack' Rintsch > > Thanks. I use that before, it does not work for me, since it always > return 1, regardless if the file content of 2 files are different or > not. > >
I think you are mixing cmp and filecmp.cmp. They are two different beasts. Cheers, Jussi -- http://mail.python.org/mailman/listinfo/python-list