The most simple way to get this error I can think of is like this. It happens because len does not know how to calculate the lenght of this object. -class classA: - def __init__(self): - pass
-a = classA() -print len (a) Traceback (most recent call last): File "./test.py", line 10, in ? print len (a) AttributeError: classA instance has no attribute '__len__' You can fix it by adding a __len__ method: class classA: def __init__(self): pass def __len__(self): return 0 a = classA() print len (a) See http://docs.python.org/ref/sequence-types.html -- http://mail.python.org/mailman/listinfo/python-list