Problém
Při spuštění rosdep update dostanete následující chybu:
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'Řešení
Tento problém nastává, protože používáte starou a zastaralou verzi rosdep - pravděpodobně jste nainstalovali rosdep 0.10.30 z robotpkg repozitáře. Pro opravu tohoto problému potřebujete upgradovat rosdep na nejnovější verzi:
install_rosdep.sh
sudo apt install python3-rosdepPoté zkontrolujte, zda je používána nová verze. Pokud ne, možná budete muset odinstalovat starou verzi.
Po upgradu rosdep můžete znovu spustit rosdep update a chyba by měla být vyřešena.
Pokud vám tento článek pomohl, zvažte, zda mi nekoupíte kávu nebo nepřispějete přes PayPal na podporu výzkumu a publikování nových článků na TechOverflow