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

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

kamek gravatar image

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

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/ 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: 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


Please explain more carefully where you tried to import MyMessageType2. Check devel/lib/python2.7/dist-packages/my_pack/msg/, and 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 image KruseT  ( 2013-01-18 03:27:30 -0500 )edit

@KruseT I updated the question to include where I tried the import (catkin_workspace/src/my_pack/scripts/ I have a 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 image kamek  ( 2013-01-18 04:04:08 -0500 )edit

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

kamek gravatar image kamek  ( 2013-01-18 04:07:49 -0500 )edit

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

Hendrik Wiese gravatar image Hendrik Wiese  ( 2013-07-24 00:23:01 -0500 )edit

How this question is "not relevant" ... ???

Kansai gravatar image Kansai  ( 2021-02-18 19:32:42 -0500 )edit