'ModuleNotFoundError' in 'actions_quiz'

Hello.

I’m in the ‘actions_quiz’ exercise from the course ‘ROS Basics in 5 days (Python) Noetic’.
I got a ‘ModuleNotFoundError’ when I try to execute my ‘actions_quiz’. Image below:

I look at other topics but the solutions given there haven’t worked for me. I tried:

  • Doing ‘rm -rf build devel’ and compiling again.
  • Searching ‘.pyc’ files in the src folder to delete them.
  • Adding more dependencies to the ‘CMakeList.txt’ and ‘package.xml’ files.
  • Removing and recreating the package several times.

The error still persists. The ‘CMakeList.txt’ and ‘package.xml’ files contain everything indicated in the lesson notebook. Here I paste my current code:

  • CMakeList.txt:

find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
  actionlib
  actionlib_msgs
)

add_action_files(
  DIRECTORY
  action
  FILES
  CustomActionMsg.action
)

generate_messages(
  DEPENDENCIES
  std_msgs actionlib actionlib_msgs # Or other packages containing msgs
)

catkin_package(
 CATKIN_DEPENDS rospy std_msgs actionlib_msgs actionlib
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

  • package.xml

<buildtool_depend>catkin</buildtool_depend>
<build_depend>actionlib</build_depend>
<build_depend>actionlib_msgs</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>actionlib</build_export_depend>
<build_export_depend>actionlib_msgs</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<exec_depend>actionlib</exec_depend>
<exec_depend>actionlib_msgs</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>

And my package folder:

modulenotfound_folder

I can’t find where I’m doing wrong. Could you help me please?

Regards.

Hi, make sure to source your environment:

source devel/setup.bash
rospack profile

If this doesn’t work, please follow the instructions to make sure you’ve named everything as instructed.

Hello.

I succeeded following this video of The Construct:

Regards.

1 Like