VanHulleOne / SciSlice

SciSlice: The Scientific Slicer. A program for creating finely controlled 3D printer toolpaths. Tailored for research purposes.
MIT License
39 stars 17 forks source link

Importing Point #5

Open llweston opened 5 years ago

llweston commented 5 years ago

I believe I've downloaded all of the dependencies properly, but I can't explain this issue with importing the Point class from Point.py b/c it is successfully imported earlier from the same directory (in figura.py it works, in unittest.py it does not, see below). aaa

VanHulleOne commented 5 years ago

Tough to say on this one. I pulled the latest version and Unittest ran just fine. Hopefully you can figure it out.

fake-name commented 4 years ago

I'm seeing this too:

(scislice) C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice>python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

(scislice) C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice>python RUN_ME.py
Traceback (most recent call last):
  File "RUN_ME.py", line 16, in <module>
    from runner import Runner           #for converting to Gcode
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\runner.py", line 7, in <module>
    import figura as fg
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\figura.py", line 22, in <module>
    from point import Point
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\point.py", line 13, in <module>
    import numpy
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import add_newdocs
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\core\__init__.py", line 74, in <module>
    from numpy.testing import _numpy_tester
  File "C:\Users\cwolf\.conda\envs\scislice\lib\site-packages\numpy\testing\__init__.py", line 10, in <module>
    from unittest import TestCase
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\unittest.py", line 9, in <module>
    from point import Point
ImportError: cannot import name 'Point'
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\figura.py", line 22, in <module>
    from point import Point
......
  File "C:\Code\robot-control\Software\MotionPlanning\scislice\SciSlice\unittest.py", line 9, in <module>
    from point import Point

There looks to be some automagic that's causing a circular import. The hacky solution is to just delete unittest.py from the project root. Numpy's unit test importer then doesn't find it, and try to import it.

VanHulleOne commented 4 years ago

When I run RUN_ME.py with Spyder everything works fine. If I try to run it from the command line I get the same error. I don't think I know enough about these Python intricacies to answer the problem. I'll try to mess with it some more but for now know that running it in Spyder will circumvent the problem.

VanHulleOne commented 4 years ago

fake-name is right, deleting unittest.py will also work around this problem from the command line.