ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Python package anomoly

asked 2012-02-24 06:02:22 -0500

cassander gravatar image

updated 2014-01-28 17:11:28 -0500

ngrennan gravatar image
from std_msgs.msg import String

when ROS encounters a statement like the one above, where does it search, to obtain String class? I check $PYTHONPATH and it doesn't seem like the class exists in a file located in that path. I searched the ROS package std_msgs..but it only shows a folder msg that has the String.msg file in it. I don't see any module called 'msg' in which I expect to find the 'String' class..

Could someone please tell me whats going on? Am I missing something fundamental or are things really twisted a little bit.. ?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-02-24 06:57:15 -0500

DimitriProsser gravatar image

updated 2012-02-24 06:58:03 -0500

Look in the std_msgs package in the src directory. When messages are generated, the resulting python module is placed in the src folder in a subdirectory with the same name as the package. So the full file path on my machine is:

edit flag offensive delete link more

answered 2012-02-24 07:26:06 -0500

To add to what DimitriProsser said, when you do roslib.load_manifest('my_package'), it alters your sys.path and add the appropriate paths so python is able to do the imports.

edit flag offensive delete link more

Question Tools


Asked: 2012-02-24 06:02:22 -0500

Seen: 268 times

Last updated: Feb 24 '12