Wie man rosdep-Fehler behebt: Rosdep experienced an error: 'list' object has no attribute 'encode'

Problem

Beim Ausführen von rosdep update erhalten Sie den folgenden Fehler:

rosdep_output.txt
reading in sources list data from /opt/openrobots/etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Add distro "ardent"

ERROR: Rosdep experienced an error: 'list' object has no attribute 'encode'
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.10.30

Traceback (most recent call last):
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/main.py", line 126, in rosdep_main
    exit_code = _rosdep_main(args)
                ^^^^^^^^^^^^^^^^^^
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/main.py", line 286, in _rosdep_main
    return _no_args_handler(command, parser, options, args)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/main.py", line 294, in _no_args_handler
    return command_handlers[command](options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/main.py", line 467, in command_update
    update_sources_list(success_handler=update_success_handler,
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/sources_list.py", line 438, in update_sources_list
    retval.append((rds, write_cache_file(sources_cache_dir, dist['distribution'], rosdep_data)))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/sources_list.py", line 493, in write_cache_file
    key_hash = compute_filename_hash(filename_key)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openrobots/lib/python3.12/site-packages/rosdep2/sources_list.py", line 479, in compute_filename_hash
    sha_hash.update(filename_key.encode())
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'encode'

Lösung

Dieses Problem tritt auf, weil Sie eine alte und veraltete Version von rosdep verwenden - möglicherweise, da Sie rosdep 0.10.30 aus dem robotpkg-Repository installiert haben. Um dieses Problem zu beheben, müssen Sie rosdep auf die neueste Version aktualisieren:

install_rosdep.sh
sudo apt install python3-rosdep

Überprüfen Sie danach, ob die neue Version verwendet wird. Wenn nicht, müssen Sie möglicherweise die alte Version deinstallieren.

Nach dem Aktualisieren von rosdep können Sie rosdep update erneut ausführen, und der Fehler sollte behoben sein.


Check out similar posts by category: ROS, Robotics