Trying to complete exercise 3.1. Did everything step by step as told in guidelines. Got such error:
Any advise?
Trying to complete exercise 3.1. Did everything step by step as told in guidelines. Got such error:
Any advise?
Misnamed module call for exercise31_pkg.exercise31 instead of exercise31_pkg.py
Hi @stanislav.sakal,
In the screenshot that you shared, I see that you have a folder called exercise31_pkg inside the parent folder with the same name, exercise31_pkg.
This is probably the reason for the error.
I would try to rename the inner folder and compile the workspace again to see if it solves the problem.
Didn’t help:
exercise31-1] ModuleNotFoundError: No module named ‘exercise31_pkg.exercise31’
[ERROR] [exercise31-1]: process has died [pid 31762, exit code 1, cmd ‘/home/user/ros2_ws/install/exercise31_pkg/lib/exercise31_pkg/exercise31 --ros-args’].
Hi @stanislav.sakal ,
You have placed the exercise32.py program file inside the package. You need to place that code inside another folder with the same package name.
You need to move exercise31.py program which is currently inside ~/ros2_ws/src/exercise31_pkg to ~/ros2_ws/src/exercise31_pkg/exercise31_pkg.
Make sure that you also have an empty python file named __init__.py in the ~/ros2_ws/src/exercise31_pkg/exercise31_pkg path.
Your final folder structure will look like this
~/ros2_ws ------------------------------> (folder)
\--- src -------------------------------> (folder)
\--- exercise31_pkg ---------------> (folder)
|--- exercise31_pkg ----------> (folder)
| |--- __init__.py --------> (file)
| \--- exercise31.py ------> (file)
|--- launch ------------------> (folder)
|--- resource ----------------> (folder)
|--- test --------------------> (folder)
|--- package.xml -------------> (file)
|--- setup.cfg ---------------> (file)
\--- setup.py ----------------> (file)
If you follow these steps correctly, your issue should be fixed.
Also make sure you have the executable defined in your setup.py file. If your executable name does not match the python script file path, then also your program will output errors.
Regards,
Girish
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.