Error "Import Command Not Found" while doing examples of service and client using rospy in Ubuntu 12.04.
While doing the example of Service and Client from this page, I am getting an error "Import Command not Found" when trying to run the Server and the Client Nodes. I have checked the code but evrything is acoording to the tutorial. Can somebody please help? I am doing these examples using rospy.
http://wiki.ros.org/ROS/Tutorials/Wri...
The file is as below :
#!/usr/bin/env python
import rospy
from beginner_tutorials.srv import *
def handle_add_two_ints(req):
print "Returning [%s + %s = %s]"%(req.a, req.b, (req.a + req.b))
return AddTwoIntsResponse(req.a + req.b)
def add_two_ints_server():
rospy.init_node('add_two_ints_server')
s = rospy.Service('add_two_ints', AddTwoInts, handle_add_two_ints)
print "Ready to add two ints."
rospy.spin()
if __name__ == "__main__":
add_two_ints_server()
Yes. I have run catkin_make and source devel/setup.bash. Infact, I have been able to sucessfully run the publish, subscribe messages tutorial in python. So, I guess python has been set up properly.
Edit : python filename.py as suggested by one of the users has worked without any errors.