I ran into a really weird problem. I am trying to use the counter function in the collections module. However, I keep getting the same error message
AttributeError: 'module' object has no attribute 'Counter'
I tried to use it before, and it worked fine, but now for some reason, when I import the “collection” module, it has a very limited number of attributes.
I tried:
import collections
For both, I keep getting the attribute error.
I also tried
from collections import Counter
And in this case, I got:
ImportError: cannot import name Counter
All of them are tested both in the ipython interface and through a script (without importing anything, just collections).
Any ideas?
branwen85
source share