rosdep update 报错情况比较多,一般情况是由于被墙了链接不上。一般可以通过修改etc/hosts以及修改延迟时间来解决。
见https://blog.csdn.net/weixin_44684139/article/details/104708387
但有一些奇奇怪怪的报错,在今天遇到了。
解决了一下午,终于搞定。
报错内容可能有以下几种,均是因为一个原因:
(1)
expected ',' or ']', but got ''
in "" , line 5954, column 17:
gentoo: [dev-p
(2)
expected ',' or ']', but got ''
(3)
rosup date ScannerError: while scanning a simple key
(4)
Failed to download target platform data for gbpdistro:
(5)
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.19.0
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 144, in rosdep_main
exit_code = _rosdep_main(args)
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 428, in _rosdep_main
return _no_args_handler(command, parser, options, args)
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 437, in _no_args_handler
return command_handlers[command](options)
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 649, in command_update
ros_distro=options.ros_distro)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 507, in update_sources_list
rosdep_data = get_gbprepo_as_rosdep_data(dist_name)
File "/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py", line 149, in get_gbprepo_as_rosdep_data
distro_file = get_release_file(gbpdistro)
File "/usr/lib/python2.7/dist-packages/rosdep2/rosdistrohelper.py", line 76, in get_release_file
dist_file = rosdistro.get_distribution_file(get_index(), distro)
File "/usr/lib/python2.7/dist-packages/rosdistro/__init__.py", line 120, in get_distribution_file
return create_distribution_file(dist_name, data)
File "/usr/lib/python2.7/dist-packages/rosdistro/distribution_file.py", line 134, in create_distribution_file
dist_file = DistributionFile(dist_name, d)
File "/usr/lib/python2.7/dist-packages/rosdistro/distribution_file.py", line 45, in __init__
assert 'type' in data, "Expected file type is '%s'" % DistributionFile._type
AssertionError: Expected file type is 'distribution'
etc/hosts文件中的151.101.64.133 raw.githubusercontent.com
失效。
在网站https://site.ip138.com/raw.githubusercontent.com/中搜索raw.githubusercontent.com,换一个ip重新rosdep update。
我是更换为了151.101.192.133 raw.githubusercontent.com
才避免了报错。