the terminator report Name error :'global name : 'AddTwoIntsResponse' is not defined'.

asked 2017-04-18 03:18:08 -0500

little_bob gravatar image

I am leaning ROS,and my distribution is Indigo,when I followed the tutorials.When I run the rosrun beginner_tutorials add_two_ints_client.py I encountered this error:Name error:global name:'AddTwoIntsResponse' is not defined.But I do find the AddTwoIntsResponse class at line 115:~/catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/srv/_AddTwoInts.py,why do this happens?

edit retag flag offensive close merge delete

Comments

I am encountering the same error. Did you ever figure this out?

kjd gravatar image kjd  ( 2018-01-17 09:09:04 -0500 )edit

Sorry, It's too long time ago. I can't remember the details about how to figure it out. But I think it is related to multiple versions of python on one PC. When you edit py files, make sure it is always using python interpreter python2.7. You can have a try.

little_bob gravatar image little_bob  ( 2018-01-17 21:33:24 -0500 )edit

If it stills acts badly, you can have another thread to ask about this. I am still confused. Maybe some onther guy will give you an answer.

little_bob gravatar image little_bob  ( 2018-01-17 21:34:14 -0500 )edit

Thanks for your response.

In my case I needed to alter my import statement in the service.py to from (package_name).srv import *. I had changed this line earlier while debugging a different problem.

kjd gravatar image kjd  ( 2018-01-18 13:21:21 -0500 )edit