Can't import the message file Age.msg in python script

i cant insert the Age.msg in the python script i am writing

Hello,

Can show you the code where the error is please.
So far, I think the issue comes from how you are trying to import the .msg

Also, did you update the CMake after creating the custom message and did you rebuild your workspace ?

1 Like

Hi,
thanks for replying
from exercise_33.msg import Age

this is the error in my code. i have updated my cmake and build the workspace but still it is not working

Run the ROS Command

rosmsg package <Your Package Name>

to figure out if message is successfully build and listed inside your package.

You will also need to source the workspace again after building custom message file.

i am writing the rosmsg and it is working normally

Hi @bazzouna98,
This type of error message could be caused by the catkin workspace not being sourced after the build.
Did you enter the source command at ~/catkin_ws ?
$ source devel/setup.bash
If it’s not the cause, can you paste here your CMakeLists.txt ?

Not sure if it’s related, but something similar happened to me and I couldn’t import the message despite following the procedure seen in the course exactly.

What solved it for me was erasing the build and devel directories, then running the catkin_make, followed by the source devel/setup.bash command.

3 Likes

Glad to hear that your problem has been solved. Please marked as solved!

1 Like

Hi,
Thank you so much for your response! Your solution worked perfectly for me.

also merci for every one answered and spending time for it, I appreciate it

after deleting the build and devel folders, and after uising catkin_make, and sourcing, at first the ros couldn’t recognise the packages but after (rospack profile) the problem was completly solved and everything worked good

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.