Ask Your Question
3

"No module named rosbag" error

asked 2011-12-11 14:36:13 -0500

suzuki tarou gravatar image

updated 2014-01-28 17:10:59 -0500

ngrennan gravatar image

I followed guide at http://www.ros.org/doc/api/rosbag/html/c++/ I runned the example usage read bag file by Python,

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages('numbers'):
   print msg.data
bag.close();

when i run the code it tells me "ImportError: No module named rosbag"

Traceback (most recent call last): File "/home/user/ros_workspace/beginner_tutorials/nodes/read_bag.py", line 4, in <module> import rosbag ImportError: No module named rosbag

please tell me how to fix this!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2011-12-11 16:41:28 -0500

fergs gravatar image

Have you added a dependency on the 'rosbag' package in your package manifest.xml?

edit flag offensive delete link more

Comments

Also you will need to use roslib.load_manifest to get the module onto your PYTHONPATH There are tutorials on using python in ROS at http://www.ros.org/wiki/rospy_tutorials/Tutorials
tfoote gravatar image tfoote  ( 2012-01-02 06:37:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-12-11 14:36:13 -0500

Seen: 9,938 times

Last updated: Dec 11 '11