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

ImportError: cannot import name Bag

asked 2020-12-16 13:14:11 -0600

rosaru gravatar image

updated 2020-12-17 01:18:27 -0600

mgruhler gravatar image

Hi, I've created a catkin workspace and I'm trying to open a rqt_bag version made by me (with some plugins). The problem comes when I try to use roslaunch to launch rqt_bag from my workspace.
If I open the standar rqt_bag it works, but if I do this, it does not work.

This is the error that it shows:

Traceback (most recent call last):
  File "/home/roberott/Escritorio/DepartamentoDeRobotica/catkin_ws/src/rqt_bag/scripts/rqt_bag", line 4, in <module>
    from rqt_bag import Bag
ImportError: cannot import name Bag
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-12-17 01:20:35 -0600

mgruhler gravatar image

It should be:

from rqt_bag.bag import Bag

edit flag offensive delete link more


It doesn't work either

rosaru gravatar image rosaru  ( 2020-12-18 17:15:35 -0600 )edit

@rosaro what does that mean? Same error message? Different error message? Please be more specific.

On a vanilla kinetic install, this works after sourcing /opt/ros/kinetic/setup.bash (iff ros-kinetic-rqt-bag is installed via apt, obviously)

> source /opt/ros/kinetic/setup.bash
> python
Python 2.7.12 (default, Oct  5 2020, 13:56:01) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from rqt_bag.bag import Bag
>>> Bag
<class 'rqt_bag.bag.Bag'>
mgruhler gravatar image mgruhler  ( 2021-01-04 04:24:26 -0600 )edit

Question Tools

1 follower


Asked: 2020-12-16 13:14:11 -0600

Seen: 292 times

Last updated: Dec 17 '20