I've suffered from unacceptable IMPORT error
Hello, I'm working with ROS kinetic on Ubuntu 16.04.
I'm trying tutorial of face_detector, but I faced a strange IMPORT error.
But I have the right module.
import rospy
from people_msgs.msg import PositionMeasurementArray
class FaceDetectClient(object):
def __init__(self):
self.face_detect_subs = rospy.Subscriber("/face_detector/people_tracker_measurements_array",
PositionMeasurementArray, self.face_detect_subs_callback)
self.pos_measurement_array = PositionMeasurementArray()
And the error message I've only got is
File "/home/robotics/catkin_ws/src/my_face_detector/scripts/face_detector_client.py", line 4, in <module>
from people_msgs.msg import PositionMeasurementArray
ImportError: No module named msg
[ INFO] [1575467542.196464019]: You must subscribe to one of FaceDetector's outbound topics or else it will not publish anything.
[face_detection_client_start_node-2] process has died [pid 26265, exit code 1, cmd /home/robotics/catkin_ws/src/my_face_detector/scripts/face_detector_client.py __name:=face_detection_client_start_node __log:=/home/robotics/.ros/log/3f210cbc-169d-11ea-b72c-07b764ec1d1d/face_detection_client_start_node-2.log].
log file: /home/robotics/.ros/log/3f210cbc-169d-11ea-b72c-07b764ec1d1d/face_detection_client_start_node-2*.log
Because when I run some other packages in /opt/ros/kinetic/share/
directory (and also people_msgs package is in /opt/ros/kinetic/share/
, it ran with any problem, I think it is not related to ros path.
If you happen to give me any advice, would you please let me know?
Thanks in advance :)
Do you using some alternative python install like
anaconda
? This usually lead to some quite strange errors, as the ROS packages don't typically end up in the respective python paths those alternative installs use.You can try to set the shebang of the script explicitely to
/usr/bin/python2.7
(or wherever your python2.7 executable is located) and check if it works then (keep the ROS env sourced, though!)