Skip to content

Commit 95c17db

Browse files
committed
-
1 parent 55fa7ed commit 95c17db

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

source_py2/python_toolbox/nifty_collections/cute_enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from python_toolbox import caching
88

99

10-
# @orking around Python bug 22506 that would be fixed in Python 3.5:
10+
# Working around Python bug 22506 that would be fixed in Python 3.5:
1111
del enum.EnumMeta.__dir__
1212
# This makes enum members not appear in `dir` but it also prevents other
1313
# important items from being deleted.

source_py3/python_toolbox/nifty_collections/cute_enum.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
import enum
4+
try:
5+
import enum
6+
except ImportError:
7+
import imp
8+
try:
9+
imp.find_module('enum')
10+
except ImportError:
11+
raise Exception(
12+
'You don\'t have the standard library Python package `enum`, '
13+
'which I guess means you\'re running Python 3.3 or earlier. '
14+
'Please either install the backported `enum34` module by running '
15+
'`pip install enum34` or upgrade your Python version to 3.4 or '
16+
'later.'
17+
)
18+
else:
19+
raise
520
import functools
621

722
from python_toolbox import caching

0 commit comments

Comments
 (0)