Ask Your Question

Cannot locate message "MultiArrayLayout" in python ROS bag API

asked 2013-03-13 03:50:43 -0500

amittleider gravatar image

updated 2013-03-13 06:11:11 -0500

Hello all,

I get the following error message when parsing a bag file with rosbag API when there is a message of type Int16MultiArray: "Cannot locate message [MultiArrayLayout]: unknown package [std_msgs] on search path [{}]."

Here is the code to parse the bag:

import roslib; roslib.load_manifest('rosbag'); roslib.load_manifest('std_msgs'); 
from std_msgs.msg import Int32, String, Int16MultiArray 
from std_msgs.msg import MultiArrayLayout, MultiArrayDimension 
for topic, msg, t in bag:   
    #do stuff here

As you can see, I include the type that I need (Int16MultiArray) and also it's subtypes (MultiArrayLayout and MultiArrayDimension), but I still get the error. Below is some stack trace.

Traceback (most recent call last):
  File "", line 163, in <module>
  File "", line 53, in main
    for topic, msg, t in bag:
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/", line 2062, in read_messages
    yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/", line 2198, in seek_and_read_message_data_record
    msg_type = _get_message_type(connection_info)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/rosbag/", line 1309, in _get_message_type
    message_type = genpy.dynamic.generate_dynamic(info.datatype, info.msg_def)[info.datatype]
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genpy/", line 151, in generate_dynamic
    for l in msg_generator(msg_context, spec, search_path):
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genpy/", line 725, in msg_generator
    genmsg.msg_loader.load_depends(msg_context, spec, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/", line 344, in load_depends
    return load_msg_depends(msg_context, spec, msg_search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/", line 313, in load_msg_depends
    depspec = load_msg_by_type(msg_context, resolved_type, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/", line 119, in load_msg_by_type
    file_path = get_msg_file(package_name, base_type, search_path)
  File "/opt/ros/fuerte/lib/python2.7/dist-packages/genmsg/", line 78, in get_msg_file
    % (base_type, package, search_path))

Thanks for the help

Edit: I should also note that the same error happens when opening the bag with rxbag.

edit retag flag offensive close merge delete


Hello! I have a very similar problem, with the same traceback. On Fuerte on Ubuntu 12.04 LTS. Final msg: MsgNotFound: Cannot locate message [Header]: unknown package [std_msgs] on search path [{}] Is there known solution?

btakac gravatar image btakac  ( 2013-04-02 04:42:17 -0500 )edit

I still have not found a solution (but haven't been looking too hard). It is quite an annoying problem for me.. I had to hack the feature in for now by converting them to a string, publishing, then parsing the string on the other side.

amittleider gravatar image amittleider  ( 2013-04-07 22:28:35 -0500 )edit

Are you using ROSJAva, I get this error for messages published from ROSJava nodes. I am thinking to implement a cpp node to rebroadcast these messages to rosbag and see if it makes a difference

PeterMilani gravatar image PeterMilani  ( 2013-06-21 17:01:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-21 20:43:38 -0500

A workaround if you are having problems with ROSJava messages and rosbag, Is to write an efficient cpp node that subscribes to the ROSJava messages you want to store and republishes on topics to rosbag using a roscpp publisher. I had been getting similar errors using Rosbag to subscribe to ROSJava messages. This allowed me to save my ROSJAVA message traffic in a bag file.

Hope this helps

edit flag offensive delete link more


Thanks. This definitely fixes the problem, but it seems odd that rosbag and rosjava don't work well together when rospy and rosjava work perfectly fine. I implemented this fix for all of my *MultiArrayLayout messages. The other message types in std_msgs work without the fix.

amittleider gravatar image amittleider  ( 2013-08-11 10:39:03 -0500 )edit

Could you guys explain how to fix this? I have several bag files that have some topics subscribed from android ros. I think it's matter of ROSJava but have no idea how to fix it. It there any way to fix the bag files to see on rqt_bag or rxbag? I'm a very beginner.

Teny gravatar image Teny  ( 2013-11-21 10:26:04 -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



Asked: 2013-03-13 03:50:43 -0500

Seen: 1,194 times

Last updated: Jun 21 '13