ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

import error no module named srv

asked 2017-09-21 08:13:12 -0500

danny5555 gravatar image

updated 2017-09-21 10:30:22 -0500

jayess gravatar image

I am struggling to progress the error (below) which I have encountered when completing this part of the tutorial link text

I'm not sure why the script I have literally copied over won't work. I have spent an hour or so trying to figure it out but can't solve it..

The code message:

danny@danny:~/catkin_ws$  rosrun beginner_tutorials add_two_ints_server.py
Traceback (most recent call last):
  File "/home/danny/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_server.py", line 3, in <module>
    from beginner_tutorials.srv import *
ImportError: No module named srv
danny@danny:~/catkin_ws$
edit retag flag offensive close merge delete

Comments

After compile your package/service with catkin_make, try to source catkin_ws/devel/setup.bash and see if it works.

Ruben Alves gravatar image Ruben Alves  ( 2017-09-29 15:36:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-21 10:34:54 -0500

jayess gravatar image

We'll need more to go off of than what you've given us. Are you going through the tutorials in order? Did you go through the Creating a ROS msg and srv and Writing a Simple Service and Client (Python) tutorials before trying run that particular tutorial? If you didn't do both of those then you will get that error.

edit flag offensive delete link more

Comments

I've done both , but also it is indicating error like this... ImportError: No module named beginner_tutorials.srv Not able to resolve it, could you help me with it ?

Trayach_ gravatar image Trayach_  ( 2020-08-09 08:32:32 -0500 )edit

You should create a new question and reference this one

jayess gravatar image jayess  ( 2020-08-09 20:32:31 -0500 )edit

while executing this rosrun beginner_tutorials add_two_ints_server.py im getting this error... Traceback (most recent call last): File "/home/chetan/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_server.py", line 3, in <module> from beginner_tutorials.srv import AddTwoInts,AddTwoIntsResponse ImportError: No module named beginner_tutorials.srv

Would you help me with it ?

Trayach_ gravatar image Trayach_  ( 2020-08-09 22:48:32 -0500 )edit

@CubeC, comments are an inappropriate place to solve problems like that. Please create a new question, it's easier to work on a problem and it will get more visibility than using comments

jayess gravatar image jayess  ( 2020-08-09 23:32:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-21 08:13:12 -0500

Seen: 2,865 times

Last updated: Sep 21 '17