0
$\begingroup$

Rosanswers logo

Hello,

I am discovering ROS groovy and I try to create a custom service. I followed the tutorial on creating a service with Python and did a Python node. But when I run my Python node, I get 'from myModuleName.srv import mysrv.srv ImportError : no module named myModuleName'

I checked with rossrv that my service is known, I also tried to follow instructions in 'What's A Catkin?'

I don't know where to look for debug logs or build errors. What should I do ?

Thanks.

Manon

PS : the more I think of it, it does not look like the service is faulty, but Python can't find the right files to import.


Originally posted by Manon on ROS Answers with karma: 1 on 2013-02-07

Post score: 0


Original comments

Comment by joq on 2013-02-09:
Please update your question with a link to the tutorial you are following, so people will know what you are doing.

Comment by Manon on 2013-02-18:
Well, I don't have enough karma to publish links. The tutorial for catkin is this one : http://www.ros.org/wiki/catkin/what and the python tutorial is the standard create a simple service and client in Python.

Comment by Manon on 2013-02-18:
Thank you for your help. I will retry and let you know the result. The problem may be that when you click on a link on the tuto you go automatically to the rosmake version so I may have followed the wrong one.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

It's an old question, but still a top hit on Google. So I'll post a possible solution:

First of all, as dornhege pointed out, your import statement is incorrect. It should be:

from myModuleName.srv import mysrv

Also, have you sourced the setup.bash file in your catkin workspace? It should be at catkin_workspace_name/devel/setup.bash (where catkin_workspace_name is swapped with the name of your catkin workspace). To source it:

source /path/path/path/catkin_workspace_name/devel/setup.bash

You can also add that line to your .bashrc file so that it's automatically sourced every time you open a terminal.


Originally posted by Benjamin Blumer with karma: 287 on 2013-11-28

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by akudoku on 2014-01-09:
lubuntu 12.4 hydro

in almost same env, the solution makes me alive! i spent a whole day to reset my project which copy the service and client example. anyway, just doing 'source ~/CATKIN_WS/devel/setup.bash' solve this problem.

i'm so happy now. thanks.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Looks like a python module that is called from other modules isn't generated, although I'm not sure since some info lacking (eg. which command you used to run your python module).

I suspect that you might have not followed creating srv tutorial. Make sure that in CreatingMsgAndSrv tutorial page choose catkin at the TOP OF THE WIKI PAGE so that you will see necessary instruction (in this case adding macro to CMakeLists.txt etc.)

ps. I know this wiki pages structure isn't ideal...I just added clarification to wiki not to miss choosing right build system.


Originally posted by 130s with karma: 10937 on 2013-02-18

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.