Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name defaultdict

I'm getting this really strange ImportError when running from collections import defaultdict:

ImportError: cannot import name defaultdict

I'm running python 2.7, and the strange part is that in other parts of my application this exact same import line succeeds.

I thought maybe that's a circular import, but it doesn't make much sense when it comes to built-in python modules.

Any ideas why I get this error?

like image 512
Tzach Avatar asked Aug 13 '14 14:08

Tzach


1 Answers

You probably have a module named 'collections' in your project.

Try renaming this module in your project.

like image 91
MilkMan Avatar answered Sep 18 '22 23:09

MilkMan