ImportError: No module named node_example.msg
I have a package named node_exemple containing an msg folder containing these files
ViewTemplate.msg To run a python file depending on this message I used :
from node example.msg import ViewTemplate
But I get this error :
from node_example.msg import ViewTemplate
ImportError: No module named node_example.msg
The CMakeLists.txt is here :
cmake_minimum_required(VERSION 2.8.3)
project(node_example)
find_package(catkin REQUIRED COMPONENTS
dynamic_reconfigure
message_generation
roscpp
rosgraph_msgs
nav_msgs
rospy
std_msgs
)
add_message_files(FILES
NodeExampleData.msg
TopologicalAction.msg
TopologicalEdge.msg
TopologicalMap.msg
TopologicalNode.msg
ViewTemplate.msg
)
generate_messages(DEPENDENCIES
geometry_msgs
std_msgs
)
generate_dynamic_reconfigure_options(cfg/nodeExample.cfg)
catkin_package(CATKIN_DEPENDS
dynamic_reconfigure
message_runtime
roscpp
rosgraph_msgs
rospy
std_msgs
visualization_msgs
)
include_directories(include ${catkin_INCLUDE_DIRS})
install(PROGRAMS
src/main_lv.py
src/pylistener.py
src/pytalker.py
src/ratslam/posecell_network.py
src/ratslam/experience_map_younes.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(PROGRAMS
src/main_lv.py
src/main_em.py
src/pytalker.py
src/ratslam/posecell_network.py
src/ratslam/experience_map_younes.py
src/ratslam/local_view_match.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
Can you post your
CMakeLists.txt
? Also, is the message in a directory calledmsg
?Yes I put the message in a directory called msg
@Younès: please update your question with new information instead of posting a new answer. I updated your question with the info from the answer that you posted (and formatted it). Please delete the answer that you posted. Thanks.
http://wiki.ros.org/Support#Guideline...
thank you ok
Did you run
catkin_make
prior to trying to run the node? You will need to do that to have the messages be generated.@Younès: just as an aside, you should look at this tutorial on using a
Makefile
with Python