wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.
http://numpy-stl.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
624 stars 105 forks source link

'module' object has no attribute 'IntEnum' #76

Closed mspringer1 closed 6 years ago

mspringer1 commented 6 years ago

hey I'm using numpy-stl with python 2.7

when I try to run the example code:

`import numpy from stl import mesh from mpl_toolkits import mplot3d from matplotlib import pyplot

VERTICE_COUNT = 100 data = numpy.zeros(VERTICE_COUNT, dtype=mesh.Mesh.dtype) your_mesh = mesh.Mesh(data, remove_empty_areas=False)

figure = pyplot.figure() axes = mplot3d.Axes3D(figure)

axes.add_collection3d(mplot3d.art3d.Poly3DCollection(your_mesh.vectors))

scale = your_mesh.points.flatten(-1) axes.auto_scale_xyz(scale, scale, scale)

pyplot.show()`

I get the error:

Traceback (most recent call last): File "/Users/.../test.py", line 2, in <module> from stl import mesh File "/Users/Malte/.conda/envs/Studienarbeit/lib/python2.7/site-packages/stl/__init__.py", line 1, in <module> from .stl import BUFFER_SIZE File "/Users/Malte/.conda/envs/Studienarbeit/lib/python2.7/site-packages/stl/stl.py", line 6, in <module> import enum ImportError: No module named enum

when i install the enum package and run the code i get following error:

Traceback (most recent call last): File "/Users/Malte/OneDrive/Uni/Master/3. Semester/Studienarbeit/Code/Studienarbeit/test.py", line 2, in <module> from stl import mesh File "/Users/Malte/.conda/envs/Studienarbeit/lib/python2.7/site-packages/stl/__init__.py", line 1, in <module> from .stl import BUFFER_SIZE File "/Users/Malte/.conda/envs/Studienarbeit/lib/python2.7/site-packages/stl/stl.py", line 12, in <module> from . import base File "/Users/Malte/.conda/envs/Studienarbeit/lib/python2.7/site-packages/stl/base.py", line 21, in <module> class Dimension(enum.IntEnum): AttributeError: 'module' object has no attribute 'IntEnum'

I've tried the uninstall stl , uninstall numpy-stl and install numpy-stl method I also have no file that is named stl.py in my project

Any idea what can cause this problem?

Uvar commented 6 years ago

Did you install enum34 ?

wolph commented 6 years ago

Since the enum import didn't fail there should be some enum package but it must be the wrong package. So... as @Uvar suggested, please make sure you have enum34 installed: pip install -U enum34

mspringer1 commented 6 years ago

yes, enum34 works fine. Thanks!