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

Problem with parent module #57

Closed ipere closed 7 years ago

ipere commented 7 years ago

Hi !

I've got a problem with the example given here: https://w.wol.ph/2015/01/28/readingwriting-3d-stl-files-numpy-stl/ Indeed, when I try to run it, I've got:

SystemError: Parent module ' ' not loaded, cannot perform relative import

And apparently it comes from "from . import base" line 19 in the stl.py file.

Thank you for your help.

wolph commented 7 years ago

These are package imports which only work when Python knows the code is part of a package.

Since it's not functioning for you I'm guessing you simply downloaded the code through a release or a git clone and are running it in your current directory. That's almost correct, but you need to tell Python where it can find the package :)

Try installing the package through pip or setup.py:

pip install -e directory_containing_the_setup.py

Or:

python setup.py develop
ipere commented 7 years ago

It has worked. Thank you !