Questions and discussion for this lecture live here. Fire away by hitting Reply below ![]()
I’m struggling a bit trying to get past an error
"TypeError: only 0-dimensional arrays can be converted to Python scalars
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/Users/jsnow/PycharmProjects/Truss_Solver/2D Cable Solver.py”, line 575, in
UG = solveDisplacements(Ks, F_inequilibrium)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jsnow/PycharmProjects/Truss_Solver/2D Cable Solver.py”, line 364, in solveDisplacements
UG[i] = U[c]
~~^^^
ValueError: setting an array element with a sequence."
With a bit of googling it seems like the way forward is to use the .items() method on U[c] but I’m not sure if this is going to have knock-on effects on other parts of the code.
I am also getting this error running the provided notebook, not just my own code so I’m not sure how you didn’t trigger this error. Any ideas?
Hey @Jonathan_Snow
Yes this is something that has changed slightly with array indexing since I first wrote the code - you can safely call .item() - in fact I suggest this elsewhere in other courses when folks have run into the issue and posted about it. There’s no knock-on impact.
Hope you’re enjoying the course.
Best,
Seán
Awesome, thank you ![]()