Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81360 > unrolled thread
| Started by | muhammedabuali@gmail.com |
|---|---|
| First post | 2014-11-23 04:10 -0800 |
| Last post | 2014-11-23 07:35 -0800 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | muhammedabuali@gmail.com |
|---|---|
| Date | 2014-11-23 04:10 -0800 |
| Subject | ImportError: cannot import name 'Enum' |
| Message-ID | <fc105124-6de7-425e-bb3d-5d9a5933b28d@googlegroups.com> |
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'
`
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-23 23:20 +1100 |
| Message-ID | <mailman.16180.1416745203.18130.python-list@python.org> |
| In reply to | #81360 |
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
[toc] | [prev] | [next] | [standalone]
| From | muhammedabuali@gmail.com |
|---|---|
| Date | 2014-11-23 07:35 -0800 |
| Message-ID | <b68e7997-3d01-4191-b808-a481329b08e3@googlegroups.com> |
| In reply to | #81361 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web