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

Import issues in ROS Kinetic & RQT

asked 2016-05-24 13:19:15 -0600

badrobit gravatar image

I am writing an RQT plugin and when I attempt to build it there are no warnings but when the system attempts to load the plugin I get the following output:

It seems like it is missing the QWidget in the python_qt_binding

 RosPluginProvider.load(juno_safe_button/juno_safe_button) exception raised in __builtin__.__import__(juno_safe_button.juno_safe_button, [JunoSafeButton]):
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 77, in load
    module = __builtin__.__import__(attributes['module_name'], fromlist=[attributes['class_from_class_type']], level=0)
  File "/home/mroscoe/juno_ws/install/lib/python2.7/dist-packages/juno_safe_button/juno_safe_button.py", line 7, in <module>
    from python_qt_binding.QtGui import QWidget
ImportError: cannot import name QWidget

PluginManager._load_plugin() could not load plugin "juno_safe_button/juno_safe_button":
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 99, in load
    self._load()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 54, in _load
    self._plugin = self._plugin_provider.load(self._instance_id.plugin_id, self._context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui_py/ros_py_plugin_provider.py", line 60, in load
    return super(RosPyPluginProvider, self).load(plugin_id, plugin_context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 83, in load
    raise e
ImportError: cannot import name QWidget
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
6

answered 2016-05-24 16:59:35 -0600

Dirk Thomas gravatar image

rqt in Kinetic uses Qt 5 and in Qt 5 the Widget class is defined in QtWidgets rather then QtGui.

edit flag offensive delete link more
0

answered 2018-07-11 08:53:01 -0600

blubbi321 gravatar image

Dirk Thomas is right. So for the lazy guys, a quick fix might be:

#from python_qt_binding.QtGui import QWidget  # <= old line commented out
from python_qt_binding.QtWidgets import QWidget  # <= new line added
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-24 13:19:15 -0600

Seen: 3,465 times

Last updated: Jul 11 '18