ImportError: cannot import name 'Enum'

muhammedabuali at gmail.com muhammedabuali at gmail.com
Sun Nov 23 16:35:40 CET 2014


On Sunday, November 23, 2014 2:20:20 PM UTC+2, Chris Angelico wrote:
> On Sun, Nov 23, 2014 at 11:10 PM,  <muhammedabuali at gmail.com> wrote:
> > Hello all,
> >
> > I am trying to use the python module but when I open the shell and write:
> >
> > ` import enum `
> >
> > I get the following error
> >
> > ` Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> >   File "/usr/lib/python3.4/enum.py", line 3, in <module>
> >     from types import MappingProxyType, DynamicClassAttribute
> >   File "/home/muhammed/workspace/python/unification/types.py", line 1, in <module>
> >     from enum import Enum
> > ImportError: cannot import name 'Enum'
> 
> Thank you for making it so clear and easy! By posting the entire
> traceback, plus everything you're expecting to see, you clearly show
> what's going on. THANK YOU!
> 
> What's happening here is that you have a file called "types.py".
> Unfortunately that name shadows the 'types' module in the standard
> library, and enum calls on that. So you'll need to rename your file,
> and then all should be well.
> 
> ChrisA

thank you alot! I didn't expect a reply that fast. I see the error now.



More information about the Python-list mailing list