Exercice 4.2 execution error message

I had placed my solution then rotate_robot_srv_client2.py ( your version of the solution)

under catkin_ws/src/robot_control/src/

And i had the following error :
raceback (most recent call last):
File “/home/user/catkin_ws/src/robot_control/src/rotate_robot_srv_client2.py”, line 4, in
from robot_control.srv import RotateRobot, RotateRobotRequest
ImportError: No module named srv

I recomplied and sourced and the problem was remaining

It worked ok when i moved it to under
robot_control/src/robot_control
or robot_control/test

can you explain ?

Hello @fgenestcvdl,

This error is happening because Python is trying to access the folder srv from the rotate_robot.py script insted of the package (which is also named robot_control). However, I’m not sure why this only happens when the scripts are inside the src folder. That’s weird.

Anyways, I have updated the notebook instructions to indicate that the scripts have to be placed inside robot_control/src/robot_control.

Thanks for the feedback again.

1 Like