Robotics StackExchange | Archived questions

No such file or directory when running "rosrun beginner_tutorials add_two_ints_server.py"

Hi, everyone!

I follow the tutorial "Writing a Simple Service and Client (Python)" and "Creating a ROS msg and srv".

When I running

rosrun beginner_tutorials add_two_ints_server.py

with tab key, the terminal shows

No such file or directory 

However, the tab key is work and I can find the file in the directory.

Moreover, I finish the the tutorial "Creating a ROS msg and srv".

I succesfully get same response as the tutorials say from typing rosmsg show beginner_tutorials/Num and rossrv show beginner_tutorials/AddTwoInts in command line.

Also, I used chmod +x scripts/add_two_ints_server.py to make the node executable, catkin_make install is done.

Cloud someone tell me what is wrong?


Edit: thank you. I try the following method, but still not work. The directory tree of my work space is

oms@oms:~/catkin_ws/src/beginner_tutorials$

And I do this:

oms@oms:~/catkin_ws$ catkin_make
Base path: /home/oms/catkin_ws
Source space: /home/oms/catkin_ws/src
Build space: /home/oms/catkin_ws/build
Devel space: /home/oms/catkin_ws/devel
Install space: /home/oms/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/oms/catkin_ws/build"
####
####
#### Running command: "make -j2 -l2" in "/home/oms/catkin_ws/build"
####
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] [  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[ 25%] Built target beginner_tutorials_generate_messages_lisp
[ 50%] Built target beginner_tutorials_generate_messages_cpp
[100%] Built target beginner_tutorials_generate_messages_py
[100%] Built target beginner_tutorials_generate_messages
oms@oms:~/catkin_ws$ source /home/oms/catkin_ws/devel/setup.bash
oms@oms:~/catkin_ws$ rosrun beginner_tutorials add_two_ints_server.py
> : No such file or directory

I type

tree /home/oms/catkin_ws/src/

then get

/home/oms/catkin_ws/src/
├── beginner_tutorials
│   ├── CMakeLists.txt
│   ├── include
│   │   └── beginner_tutorials
│   ├── msg
│   │   └── Num.msg
│   ├── package.xml
│   ├── package.xml~
│   ├── scripts
│   │   ├── add_two_ints_client.py
│   │   ├── add_two_ints_client.py~
│   │   ├── add_two_ints_server.py
│   │   ├── add_two_ints_server.py~
│   │   ├── listener.py
│   │   ├── listener.py~
│   │   ├── talker.py
│   │   └── talker.py~
│   ├── src
│   └── srv
│       └── AddTwoInts.srv
├── CMakeLists.txt -> /opt/ros/indigo/share/catkin/cmake/toplevel.cmake
└── one
    ├── CMakeLists.txt
    ├── include
    │   └── one
    ├── msg
    │   └── Num.msg
    ├── package.xml
    ├── package.xml~
    ├── scripts
    │   ├── add_two_ints_client.py
    │   ├── add_two_ints_client.py~
    │   ├── add_two_ints_server.py
    │   └── add_two_ints_server.py~
    ├── src
    └── srv
        └── AddTwoInts.srv

14 directories, 23 files

Sorry about that, I don't know how to change the format of above words to make it more clearly.

Asked by KTChen on 2016-06-01 04:16:51 UTC

Comments

Have done "source /path/to/your/workspace/devel/setup.bash" ?

Asked by siddhesh on 2016-06-01 05:59:16 UTC

Thank you. I try it, but my rospy node still not work. I edit my question for adding what I type and what I get.

Asked by KTChen on 2016-06-01 19:44:41 UTC

Perhaps, if you did catkin_make install you have to source install space, not devel.

Asked by Boris on 2016-06-02 04:23:29 UTC

After I trying source install/setup.bash, the tab key is not work. Then, I get

[rosrun] Couldn't find executable named add_two_ints_server.py below /home/oms/catkin_ws/install/share/beginner_tutorials

Asked by KTChen on 2016-06-02 04:42:02 UTC

Finally, I try this tutorial again without copy and paste the rospy code. I type the code my self and rospy node is work now. However, the original package I made still does not work and I do not know why. Thank you all for these helps.

Asked by KTChen on 2016-06-05 00:54:18 UTC

Answers

Did you remember to source /path/to/your/catkin_ws/devel/setup.bash after building with catkin_make and before trying to rosrun?

Asked by gvdhoorn on 2016-06-01 05:59:10 UTC

Comments

Thank you. I have tried it, but the node still not work. I add what I try in the original question. Could you tell me what is wrong in my work?

Asked by KTChen on 2016-06-01 19:49:48 UTC

Please add the output of tree /home/oms/catkin_ws/src to your question (use the edit button/link).

Asked by gvdhoorn on 2016-06-02 02:43:57 UTC

I know this is an old question but I have the same problem and it turn out to be the end of line problem. Apparently the linux and window EOL is different.

Asked by DevoRos on 2017-04-13 10:16:11 UTC

Comments