Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhashable type : 'dict' error is returned when running the examples #16

Open
1 task done
viniciusdaroz opened this issue Dec 1, 2023 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@viniciusdaroz
Copy link
Collaborator

🔍 Before submitting the issue

  • I have searched among the existing issues

🐞 Description of the bug

The examples are running fine, but matplotlib is not able to plot the results from the GetNumpyCurve method.

The issue is that the GetNumpyCurve returns a dictionary instead of a numpy array. I was able to run one of the examples once, after rebooting my computer. However, after trying it again, it raised the same error.

The same commands run fine inside Rocky's Python shell.

My Python version is 3.11.5

✅ Expected behavior

The expected behavior would be the matplotlib plot to show up.

📝 Steps to reproduce

In my case, I just cloned the repository, installed pyRocky, and executed the examples.

📃 Relevant log output

This is the output and traceback for the particle_wall_interaction_with_motion.py example.

Download successful. File path:
C:\Users<redacted>\AppData\Local\Temp\pyrocky_etw0hy1l\Lshape_tube.stl
Traceback (most recent call last):
File "C:<redacted>\pyrocky\examples\basic_examples\particle_wall_interaction_with_motion.py", line 104, in
ax.plot(times, mass_flow_in, "b", label="Mass Flow In")
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\axes_axes.py", line 1721, in plot
lines = [*self._get_lines(self, *args, data=data, **kwargs)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\axes_base.py", line 303, in call
yield from self._plot_args(
^^^^^^^^^^^^^^^^
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\axes_base.py", line 494, in _plot_args
axes.xaxis.update_units(x)
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\axis.py", line 1712, in update_units
default = self.converter.default_units(data, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\category.py", line 105, in default_units
axis.set_units(UnitData(data))
^^^^^^^^^^^^^^
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\category.py", line 181, in init
self.update(data)
File "C:\Users<redacted>.ansys_python_venvs\Rocky\Lib\site-packages\matplotlib\category.py", line 214, in update
for val in OrderedDict.fromkeys(data):
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'dict'

@viniciusdaroz viniciusdaroz added the bug Something isn't working label Dec 1, 2023
@igortg
Copy link
Collaborator

igortg commented Feb 20, 2024

Thanks for the report @viniciusdaroz

Which version of Rocky you are using?
Which version of matplotlib you are using?

I tested with the following toolchain, and it's working:

matplotlib                3.8.3
numpy                     1.26.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants