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

Revision history [back]

click to hide/show revision 1
initial version

This turned out not to be a problem with rosbridge_library at all, but a collateral effect of using gevent in my application. It's highly unlikely that anyone else will come across this, but just in case:

I had to bury down into the depths of roslib to find out where the root exception was occurring. It was in rospkg/os_detect.py:

def _read_stdout(cmd):
    try:
        pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (std_out, std_err) = pop.communicate()
        # Python 2.6 compatibility
        if isinstance(std_out, str):
            return std_out.strip()
        return std_out.decode(encoding='UTF-8').strip()
    except:
        return None

The line pop.communicate() was giving an error 'module' object has no attribute 'poll'.

This led me here: https://groups.google.com/forum/embed/#!topic/gevent/IzWhGQHq7n0

gevent is a coroutine based sort-of-multitasking library. It monkey patches various system libraries (I should have known better!) and removes the poll() functionality from subprocesses.

The solution is to import gevent like so:

from gevent import monkey; monkey.patch_all(aggressive=False)

instead of:

from gevent import monkey; monkey.patch_all()

My apologies to Jihooni for taking up his time! Thanks again.