Skip to content

binding_helper fails when "future" package is installed #24

@John-Nagle

Description

@John-Nagle

Ubuntu 14.04 LTS / 64 bit. ROS/Gazebo Jade installed per instructions at "http://wiki.ros.org/jade/Installation/Ubuntu"

I'm working through the tutorials, in order. Everything went well until the first use of "rqt_graph" in the turtle tutorial. This produced the error:

rosrun rqt_graph rqt_graph
Traceback (most recent call last):
  File "/opt/ros/jade/lib/rqt_graph/rqt_graph", line 8, in <module>
    sys.exit(main.main(sys.argv, standalone='rqt_graph.ros_graph.RosGraph'))
  File "/opt/ros/jade/lib/python2.7/dist-packages/rqt_gui/main.py", line 59, in main
    return super(Main, self).main(argv, standalone=standalone, plugin_argument_provider=plugin_argument_provider, plugin_manager_settings_prefix=str(hash(os.environ['ROS_PACKAGE_PATH'])))
  File "/opt/ros/jade/lib/python2.7/dist-packages/qt_gui/main.py", line 336, in main
    from python_qt_binding import QT_BINDING
  File "/opt/ros/jade/lib/python2.7/dist-packages/python_qt_binding/__init__.py", line 55, in <module>
    from .binding_helper import loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION  # @UnusedImport
  File "/opt/ros/jade/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 265, in <module>
    getattr(sys, 'SELECT_QT_BINDING_ORDER', None),
  File "/opt/ros/jade/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 84, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/jade/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 139, in _load_pyqt
    _named_import('PyQt4.%s' % module_name)
  File "/opt/ros/jade/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 106, in _named_import
    module = builtins.__import__(name)
AttributeError: 'module' object has no attribute '__import__'

For Python 2.7.6, that's a standard error. There is no

builtins.__import__

in Python 2.7.6. It's there in 2.7.9, and 3.x, but not 2.7.6. So, with the stock Python of Ubuntu 14.04 LTS, ROS won't work.

From the Python documentation:

"__import__ is an advanced function that is not needed in everyday Python programming, unlike importlib.import_module()." 

It's an internal function which changes between Python releases. Using it in binding_helper created a bug. Importlib should be used instead.

See also "http://answers.ros.org/question/210762/rqt_graph-not-finding-qt4/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions