📅 2015-Jul-16 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ enum, error, python ⬩ 📚 Archive
I had code that had worked correctly with Python 2.7 and that used the old enum module. Recently it started throwing this error:
$ ./foo.py Traceback (most recent call last): File "./foo.py", line 146, in <module> main() File "./foo.py", line 100, in draw_plot if PlotType.Line == plot_type: File "/usr/local/lib/python2.7/dist-packages/enum/__init__.py", line 373, in __getattr__ raise AttributeError(name) AttributeError: Line
This error is caused when the enum34 module has been installed alongside the old enum module. enum34 is the backport for Python 2.x of the standard enum in Python 3.4. Many packages have started to use it and so it will be installed implicitly while installing another package. enum34 overrides the old enum files and causes this error.
You could remove enum34 and get rid of this error. But since Python 3.x has already adapted a new enum type, it might be wiser to uninstall the old enum and rewrite your code to use enum34. Its syntax is shown in this example.
Tried with: Python 2.7.6 and Ubuntu 14.04