Cannot import custom message using rospy (Groovy) [closed]

asked 2013-01-18 02:43:49 -0600

kamek gravatar image

updated 2013-01-18 04:01:33 -0600

I have several custom messages created. I can safely import all of them except for one. Running rosmsg show finds the message. I have done the catkin_make and rebuilt the project. The auto-generated header for the message file exists in devel/include. The message is included in add_message_files() in CMakeLists.txt. Despite all of this, I have a script (i.e., my_pack/scripts/my_script.py) that tries:

from my_pack.msg import MyMessageType1, MyMessageType2

gives me

ImportError: cannot import name MyMessageType2

I can't see any differences between MyMessageType1 and MyMessageType2. Does anyone have any ideas on what could cause an error like this?

EDIT: I have seen this question: http://answers.ros.org/question/52687/cannot-find-custom-message-groovy/ in which the problem might have been the message being inconsistently named. This is not the case for me, the message is the same name everywhere.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-10-14 16:10:18.342562

Comments

Please explain more carefully where you tried to import MyMessageType2. Check devel/lib/python2.7/dist-packages/my_pack/msg/__init__.py, and _MyMessageType2.py for anything odd. The only other thing I could imagine is that you use the installspace instead of develspace, but have not installed yet.

KruseT gravatar imageKruseT ( 2013-01-18 03:27:30 -0600 )edit

@KruseT I updated the question to include where I tried the import (catkin_workspace/src/my_pack/scripts/my_script.py). I have a setup.py that includes all the scripts in the scripts folder and catkin_python_setup() is called from CMakeLists.txt. I do not have an install space, only a devel space.

kamek gravatar imagekamek ( 2013-01-18 04:04:08 -0600 )edit

@KruseT I can't see anything odd in the files you mentioned. __init__.py has both from _MyMessageType1 import * and from _MyMessageType2 import *, and _MyMessageType1.py and _MyMessageType2.py look very similar (with the fields being slightly different, of course).

kamek gravatar imagekamek ( 2013-01-18 04:07:49 -0600 )edit

Same problem here... any solution yet? Have you found the cause?

Hendrik Wiese gravatar imageHendrik Wiese ( 2013-07-24 00:23:01 -0600 )edit