Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81373

Re: ImportError: cannot import name 'Enum'

Newsgroups comp.lang.python
Date 2014-11-23 07:35 -0800
References <fc105124-6de7-425e-bb3d-5d9a5933b28d@googlegroups.com> <mailman.16180.1416745203.18130.python-list@python.org>
Message-ID <b68e7997-3d01-4191-b808-a481329b08e3@googlegroups.com> (permalink)
Subject Re: ImportError: cannot import name 'Enum'
From muhammedabuali@gmail.com

Show all headers | View raw


On Sunday, November 23, 2014 2:20:20 PM UTC+2, Chris Angelico wrote:
> On Sun, Nov 23, 2014 at 11:10 PM,  <muhammedabuali@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.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

ImportError: cannot import name 'Enum' muhammedabuali@gmail.com - 2014-11-23 04:10 -0800
  Re: ImportError: cannot import name 'Enum' Chris Angelico <rosuav@gmail.com> - 2014-11-23 23:20 +1100
    Re: ImportError: cannot import name 'Enum' muhammedabuali@gmail.com - 2014-11-23 07:35 -0800

csiph-web