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


Groups > comp.lang.python > #81361

Re: ImportError: cannot import name 'Enum'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'importerror:': 0.07; 'rename': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; '23,': 0.16; 'enum': 0.16; 'expecting': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'module': 0.19; 'trying': 0.19; 'file,': 0.19; 'import': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'library,': 0.24; 'cc:2**0': 0.24; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'see,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'posting': 0.31; 'that.': 0.31; '"",': 0.31; 'file': 0.32; 'open': 0.33; '(most': 0.33; 'skip:d 20': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'skip:" 50': 0.36; 'should': 0.36; 'clear': 0.37; 'thank': 0.38; 'nov': 0.38; 'pm,': 0.38; 'recent': 0.39; 'called': 0.40; 'skip:u 10': 0.60; 'entire': 0.61; "you're": 0.61; "you'll": 0.62; 'making': 0.63; 'show': 0.63; 'name': 0.63; 'here': 0.66; 'shadows': 0.84; 'write:': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Zbj81p7PTFcGVHVbiJ16S7Ng5WETUnpStIdpIRENVQ8=; b=F+RJYl628o5tCXn/OtF/7gjAyiczZrFaU5sXR6LqNWph+HjlUmLLoPYDdmMh0S4iQv jRRpB9Dl0r+GYx67JXUSMefivk23rvDbQAf/JdZV/qY2jvIPB1YV69D03ZWcwDGKnAqo HRKSoip8+EWcc8Zggzgd/hf+s67J6fv/higI58mX7BnxVVn7JhKN7vpu52QloGHAE/zk Pp2Joa3E8VhTXeqzQFot7CL2BxwHgn14XpaT3jaoXfp0fJKmts+wTz5xlYtBKB7sorsj f+RJE9r+ij/WKttcKbn5fvk/L9yQoi/pZK7394fs/rYnPEmdTP+8P3FiubLPxZNX6UsC sUpw==
MIME-Version 1.0
X-Received by 10.42.64.143 with SMTP id g15mr13184083ici.59.1416745201106; Sun, 23 Nov 2014 04:20:01 -0800 (PST)
In-Reply-To <fc105124-6de7-425e-bb3d-5d9a5933b28d@googlegroups.com>
References <fc105124-6de7-425e-bb3d-5d9a5933b28d@googlegroups.com>
Date Sun, 23 Nov 2014 23:20:01 +1100
Subject Re: ImportError: cannot import name 'Enum'
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16180.1416745203.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416745203 news.xs4all.nl 2968 [2001:888:2000:d::a6]:49606
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81361

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next — Previous in thread | Next 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