ros / urdf_parser_py

Standalone URDF parser for Python.
83 stars 48 forks source link

Seems to be incompatible with python3.10 #81

Closed sam-dirac closed 10 months ago

sam-dirac commented 11 months ago

When I try to use your package from the ros docker image for humble, I get errors such as this from urdf_parser_py running with python.310:

"/integration_tests/ros/assembly_view/assembly_view/state_publisher.py", line 67, in <module>
    main()
  File "/integration_tests/ros/assembly_view/assembly_view/state_publisher.py", line 62, in main
    print(urdf)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 91, in __str__
    return yaml.dump(self.to_yaml()).rstrip()
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 87, in to_yaml
    return to_yaml(raw)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 68, in to_yaml
    out[str(var)] = to_yaml(value)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 72, in to_yaml
    elif isinstance(obj, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

The suggestion I've been given is to downgrade, but would it be possible to support python3.10? Or am I missing something else here?

The error message AttributeError: module 'collections' has no attribute 'Iterable' is due to a change in Python 3.10. The Iterable class has been moved from collections to collections.abc.

The error is coming from the urdf_parser_py package, which seems to be using the old import path. This package needs to be updated to work with Python 3.10.

As a workaround, you can use an older version of Python (3.9 or earlier) where collections.Iterable is still valid.

Can you please verify that your package works in python3.10?

clalancette commented 11 months ago

Can you please verify that your package works in python3.10?

As far as I know, it works fine with Python 3.10 and later. Looking at the current code, we correctly reference collections.abc.Iterable

However, I notice that the path to urdf_parser_py seems to be wrong. It shouldn't be in /usr/local/lib; it should be in /opt/ros/humble. Did you somehow install urdf_parser_py from pip?

clalancette commented 10 months ago

I'm going to assume the last comment is what is going on, and go ahead and close this one out.