I cannot find the error in these files. I tried ros2 run and get a error that says not executable file. I tried to put all the docs in order.

I cannot find the error in these files. I tried ros2 run and get a error that says not executable file. I tried to put all the docs in order.
Hi @ROxX, based on your screenshots of your file names, you’ve added the console scripts incorrectly in setup.py
.
How it should be:
'executable_name = pkg_name.file_name:main'
I can only see quiz_client.py
and quiz_server.py
in your package, so it makes sense that server_test
and client_test
would give you issues.
Thank you for the response. Many of the examples use similar names for files, executable, and pkg. I changed the setup file but now have a different error. I thought the executable was the same as the super__init__ node. I am still not understanding some critical basic requirements.
This can be two things:
services_quiz_server.launch.py
is still incorrectly calling for an executable server_test
. If that’s the case, you need to change to the name specified in setup.py
, recompile, source, and launch again./build
, /install
) still have information related to server_test
which is giving out errors. Based on your error output, this is less likely. But to fix this, you can just remove the directories and compile, source, and launch again: cd ~/ros2_ws && rm -rf /build /install && colcon build && source install/setup.bash
As for your confusion with super().__init__('client_test')
, it’s important to differentiate what each thing is and what it does:
setup.py
(and in C++, in CMakeLists.txt
)super().__init__('client_test')
is a built in method in Python that invokes a constructor of the parent class it is in (in this case, Node
from rclpy.node
). This is all Python, and has nothing to do with ROS 2 or its structureThank you for your response, I renamed the executable in both launch and setup.py files and the error is still there. I ran the remove and install code as well. Here are all the files.
The first part of those console scripts in setup.py
are actually the executable names. You need to change them since what you are doing:
ros2 run [PACKAGE_NAME] [EXECUTABLE_NAME]
ros2 run services_quiz quiz_client
is calling for quiz_client
, but the executable names you have are client_test_2
and server_test_2
. Change those to:
entry_ponts={
'console_scripts' : [
'[EXECUTABLE_NAME] = [PACKAGE_NAME][FILE_NAME]:main'
'quiz_client = ...
Thank you for your review. I found an error in the setup.py file. I missed a comma in the console scripts file between the two lines that define the executable. I now have successfully completed the quiz and will submit it for review and grading. I really appreciate the reviews that you and others provide.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.