urdfpy icon indicating copy to clipboard operation
urdfpy copied to clipboard

Trying to access the `meshes` attribute of `Cylinder` throws an error.

Open manuelli opened this issue 2 years ago • 4 comments

If g = Cylinder(1.0, 2.0) and you try to access the g.meshes field then it throws the following error

File "/usr/local/lib/python3.6/dist-packages/urdfpy/urdf.py", line 398, in meshes
    if len(self._meshes) == 0:
TypeError: object of type 'NoneType' has no len()

This is because self._meshes got initialize to self._meshes = None on this line instead of self._meshes = [] like in the other primitive types, e.g. Box. Should be a simple fix to just set self._meshes = [] in the Cylinder constructor.

manuelli avatar Aug 20 '21 19:08 manuelli

This appears to be fixed on the tip of master. @mmatl Any chance we can bump the version and push a new package to pypi so this is fixed in the versions installed via pip or conda?

miker2 avatar Feb 09 '23 02:02 miker2

@miker2 for what regard the conda-forge build, if you have any idea of what is the commit that fixed the issue we can try to backport it on the top of the latest release, as we did for another issue (https://github.com/mmatl/urdfpy/issues/27) in https://github.com/conda-forge/urdfpy-feedstock/pull/3/files .

traversaro avatar Feb 13 '23 08:02 traversaro

@traversaro I believe it's this commit that resolves the problem: https://github.com/mmatl/urdfpy/commit/5466842899b33bd549e8f9e2a9a987bd5e37373b

I verified that installing from source from the master branch resolved the problem for me.

adamconkey avatar Apr 13 '23 20:04 adamconkey

@traversaro I believe it's this commit that resolves the problem: 5466842

I verified that installing from source from the master branch resolved the problem for me.

Ok, I opened a PR to backport the fix in the conda-forge released version in https://github.com/conda-forge/urdfpy-feedstock/pull/5, thanks!

traversaro avatar Apr 14 '23 10:04 traversaro