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

Tutorial rosmsg error

asked 2011-07-05 21:02:41 -0500

Peter gravatar image

updated 2014-01-28 17:09:59 -0500

ngrennan gravatar image

Hi,

I was learning ROS by doing the tutorials. But at tutorial 5 (http://www.ros.org/wiki/ROS/Tutorials/UnderstandingTopics) at section 13.1 I encountered the following error:

s0214828@pma-09-043:/net/pma-robot-quad/home/nfs/s0214828$ rosmsg show turtlesim/Velocity 
Traceback (most recent call last):
  File "/home/s0214828/studentjob/ros-py3/ros/bin/rosmsg", line 35, in <module>
    rosmsg.rosmsgmain()
  File "/home/s0214828/studentjob/ros-py3/ros_comm/tools/rosmsg/src/rosmsg.py", line 537, in rosmsgmain
    rosmsg_cmd_show(ext, full)
  File "/home/s0214828/studentjob/ros-py3/ros_comm/tools/rosmsg/src/rosmsg.py", line 421, in rosmsg_cmd_show
    rosmsg_debug(mode, arg, options.raw)
  File "/home/s0214828/studentjob/ros-py3/ros_comm/tools/rosmsg/src/rosmsg.py", line 285, in rosmsg_debug
    print get_msg_text(type_, raw=raw)
  File "/home/s0214828/studentjob/ros-py3/ros_comm/tools/rosmsg/src/rosmsg.py", line 255, in get_msg_text
    text = str(spec)
  File "/home/s0214828/studentjob/ros-py3/ros/core/roslib/src/roslib/msgs.py", line 354, in __str__
    return _strify_spec(self)
  File "/home/s0214828/studentjob/ros-py3/ros/core/roslib/src/roslib/msgs.py", line 249, in _strify_spec
    buff.write("%s%s %s\n"%(indent, type_, name))
AttributeError: 'builtin_function_or_method' object has no attribute 'write'

Does anyone know how I can resolve this error?

Thanks, Peter

EDIT My python version is : Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-09-02 10:44:34 -0500

mmwise gravatar image

This question hasn't been updated or commented on in over a month. Closing

edit flag offensive delete link more
1

answered 2011-07-05 21:31:09 -0500

Peter gravatar image

updated 2011-07-05 21:32:00 -0500

OK, I viewed the msgs.py file where the error came from. And I found this lines (240..244) where causing the error:

if buff is None:
    if sys.hexversion > 0x03000000: #Python3    
        buff = BytesIO()
    else:
        buff = StringIO

I noticed that StringIO is imported from cStringIO so it has to be a method. I added parentheses and changed the code to:

if buff is None:
    if sys.hexversion > 0x03000000: #Python3    
        buff = BytesIO()
    else:
        buff = StringIO()

And now the call to rosmsg works.

Am I the only one with a bug in the /ros-py3/ros/core/roslib/src/roslib/msgs.py file?

edit flag offensive delete link more

Comments

How did you install ROS?
fergs gravatar image fergs  ( 2011-07-06 04:44:01 -0500 )edit
I didn't install it myself. Somebody helped me install it because it is installed on a lab computer to which I don't have all rights.
Peter gravatar image Peter  ( 2011-07-06 18:58:57 -0500 )edit

Question Tools

Stats

Asked: 2011-07-05 21:02:41 -0500

Seen: 545 times

Last updated: Sep 02 '11