ROS noetic view_frames TypeError: cannot use a string pattern on a bytes-like object
ROS noetic + Ubuntu20.04报错:mc@ubun:~$ rosrun tf view_framesListening to /tf for 5.0 secondsDone Listeningb'dot - graphviz version 2.43.0 (0)\n'Traceback (most recent call last):File "/opt/ros/noetic/l
·
ROS noetic + Ubuntu20.04报错:
mc@ubun:~$ rosrun tf view_frames
Listening to /tf for 5.0 seconds
Done Listening
b'dot - graphviz version 2.43.0 (0)\n'
Traceback (most recent call last):
File "/opt/ros/noetic/lib/tf/view_frames", line 119, in <module>
generate(dot_graph)
File "/opt/ros/noetic/lib/tf/view_frames", line 89, in generate
m = r.search(vstr)
TypeError: cannot use a string pattern on a bytes-like object
查了一下,search函数需要输入str类型数据,而vstr(有可能?)不是str类型,所以需要把
m = r.search(vstr)
改成,
m = r.search(str(vstr))
如下,
try:
vstr = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[1]
except OSError as ex:
print("Warning: Could not execute `dot -V`. Is graphviz installed?")
sys.exit(-1)
v = distutils.version.StrictVersion('2.16')
r = re.compile(".*version (\d+\.?\d*)")
print(vstr)
m = r.search(str(vstr))
不过同样官方的说法如下,
将
m = r.search(vstr)
改为,
m=r.search(vstr.decode('utf-8'))
我试了一下,两种都能给出正确的结果。
昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链
更多推荐

所有评论(0)