[ros-users] Python import error

Mike Purvis mpurvis at clearpathrobotics.com
Tue Jun 29 22:04:18 UTC 2010


Hi all,

I'm sorry if this a dumb question, but I'm having trouble importing the Joy
message into my python script. My manifest:

<package>
  <description brief="clearpath_horizon">
     clearpath_horizon
  </description>
  <author>Mike Purvis</author>
  <license>BSD</license>
  <review status="unreviewed" notes=""/>
  ...
  <depend package="joy"/>
  ...
</package>

And then I run rosmake without a problem (and I can roscd to joy, and run
joy_node without a problem, verifying its operation with rostopic echo).

In my own node, I have:

#!/usr/bin/python

# ROS stuff
import roslib; roslib.load_manifest('clearpath_horizon')
import rospy

from geometry_msgs.msg import Twist
from joy.msg import Joy

rospy.init_node('horizon_joy', anonymous=True)

But on startup, it dies with:

  File "/home/mpurvis/Clearpath/ros-clearpath/clearpath_horizon/src/joy.py",
line 9, in <module>
    from joy.msg import Joy
ImportError: No module named msg

Can anyone figure out what's going on here? I use messages from
geometry_msgs and nav_msgs, and even gps_common. So I'm not sure what could
be the issue here. Failing some silly error in the above, is there something
special in the way the joy package is set up that I need to accommodate?
Would it be better to just copy the message file over and remove the
dependency?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100629/22c2432d/attachment-0002.html>


More information about the ros-users mailing list