BitFreak
BitFreak

Reputation: 416

Getting ImportError: cannot import name SRV in ROS

I have a ROS server MY_Warning and I have the file node/srv/MY_Warning.srv which contains:

typ1 var1
typ2 var2                                                                                                                                                                                                                                                                  
---                                                                                                                                                                                                                                                                             
typ3 var3 

in node/src/subdir/main.py (which contains the server) I have from node.srv import MY_Warning, MY_WarningResponse but I'm getting:

    from node.srv import MY_Warning, MY_WarningResponse
ImportError: cannot import name EOR_Warning

while rossrv show MY_Warning shows me the correct/expected thing:

$ rossrv show MY_Warning
[node/MY_Warning]:
typ1 var1
typ2 var2
---
typ3 var3

What am I missing or doing wrong here? I don't get it...

Upvotes: 1

Views: 2432

Answers (2)

patel deven
patel deven

Reputation: 750

Am i missing something? The missing error for import and the import statements do not match. The module in the error message is not the one imported

Upvotes: 1

UserK
UserK

Reputation: 908

I came across the same error. In other questions, the route of the error was a naming issue. Don't think it is in your case, even if in your error EOR_Warning appears, You should get My_Warning.

Check if the ouotput of ls devel/include/node/. Can you see the headers?

Try:

catkin_make clean
catkin_make --only-pkg-with-deps node
rosrun node main.py

And try again to import the ROS service. This solved my problem.

Upvotes: 1

Related Questions