import rospy ..._traceback (most recent call last">
赞
踩
实现订阅者Subscriber的测试编程,执行命令:
$ rosrun learning_topic pose_subscriber.py
遇到如下错误:
- Traceback (most recent call last):
- File "/home/yue/catkin_ws/src/learning_topic/scripts/pose_subscriber.py", line 10, in <module>
- import rospy
- File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/__init__.py", line 47, in <module>
- from std_msgs.msg import Header
- File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
- from ._Bool import *
- File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/_Bool.py", line 6, in <module>
- import genpy
- File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/__init__.py", line 34, in <module>
- from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
- File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/message.py", line 48, in <module>
- import yaml
- ModuleNotFoundError: No module named 'yaml'
解决方法:
$ rosrun learning_topic pose_subscriber.py ;
在上述命令行的基础上删除.py后缀,就可以了。
实验结果:删除.py后缀,可以看出程序执行正常。
$ rosrun learning_topic pose_subscriber
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。