ImportError : No module named xxx.msg. CMakeLists.txt, package.xml, terminal output, code
Hi,
I am very tired trying more and more, but I want to try unless i accomplish.
I have already read dozens of ros.org links and watched two popular youtube videos according to this ImportError problem:
https://www.youtube.com/watch?v=NKeeb...
https://www.youtube.com/watch?v=ZPmlF...
I am doing exactly as they say, however at the end I still get this f**king error ImportError!!
Please, help me who is aware of this problem.
I have changed Cmakelists, package.xml, everything everything, but still((( Everything is going exactly the same as these videos, but at the last minutes of video I am getting ImportError
Can you post some information about your problem? To help you we'd need to see the exact error and your CMakeLists.txt and package.xml
Thanks.
My package.xml (besides comments):
<buildtool_depend>catkin</buildtool_depend> <build_depend>message_generation</build_depend> <exec_depend>message_runtime</exec_depend>
My CMakeLists.txt(the places where I made changes):
find_package(catkin REQUIRED COMPONENTS std.msgs message_generation )
add_message_files( FILES Robotjon.msg )
generate_messages( DEPENDENCIES std_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime
)
My python code:
#! /usr/bin/env python
import rospy
from mode_publishers.msg import Robotjon
rospy.init_node('topic_publisher') pub = rospy.Publisher('/topic_ex', Robotjon, queue_size=1) rate=rospy.Rate(2) message = Robotjon() message.custom_msg = "Hello World"
while not rospy.is_shutdown(): pub.publish(message) rate.sleep()
My Robotjon.msg:
string custom_msg
My Robotjon.msg file is inside the mode_publishers package
I don't see anything obviously wrong with the snippets you've posted. Here's some things to check: 1. Is
Robotjon.msg
in themode_publishers/msg
directory. 2. Are there any spelling mistakes? Maybe an extra _ or ani
instead of aj
? 3. Do you get any errors when you run catkin_make? 4. Does the package name in thepackage.xml
file match the package name in theCMakeLists.txt
? 5. After you source devel/setup.bash what do you have in your PYTHONPATH environment variable? Does mode_publishers show up?Robotjon
is in themode_publishers/msg
directory.When I am running rosmsg show Robotjon:
I think everything is ok
BUT During running catkin_make I noticed that there are no such messages in my terminal during compiling like in youtube videos:
[16%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....[33%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....[50%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....[66%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....[83%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....[100%] BUILT TARGET <name of package>_generate_messages
Scanning dependencies.....@Nurbek can you please update your question with this information (code, package.xml, CMakelists.txt, terminal output)? Having this information in the comments in the comments makes your question difficult to follow.
Also, did you
source
yoursetup.bash
file? I.e., runfrom the root of your workspace?