StructPy icon indicating copy to clipboard operation
StructPy copied to clipboard

Are the examples supposed to work?

Open ghost opened this issue 5 years ago • 1 comments

Just downloaded and "bash run_tests.sh" ran ok. Tried to run "python3.8 'Truss 1.py' and got

Traceback (most recent call last):
  File "Truss 1.py", line 16, in <module>
    s1.addNode(0, 0, fixity='pin')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/StructPy/structural_classes.py", line 138, in addNode
    node = self.__class__.NodeType(x, y, n=n, cost=cost, fixity=fixity)
AttributeError: type object 'Structure' has no attribute 'NodeType'

Poked around and in Truss1.py s1 is an instance of Structure. Grepped around and found 'NodeType' defined in a class called Truss but no reference to Truss in Truss1.py and s1 is certainly not a Truss, it's a Structure.

So I'm wondering if I am doing something wrong or if the examples are broken.

Thanks!

ghost avatar Dec 04 '20 03:12 ghost

They were supposed to but I didn't update them after I made changes to how the rest of the code worked. The tests in docstrings and the tests in Unit Tests would be a better reference for using the other code.

BrianChevalier avatar Dec 11 '20 07:12 BrianChevalier