ImportError: cannot import name 'AddTwoInts' from 'beginner_tutorials.srv'
While going through the tutorial Examining ServiceClients, whenever I execute $ rosrun beginner_tutorials add_two_ints_server.py I get the error Traceback (most recent call last): File "/home/sanjay/catkin_ws/devel/lib/beginner_tutorials/add_two_ints_server.py", line 15, in <module> exec(compile(fh.read(), python_script, 'exec'), context) File "/home/sanjay/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_server.py", line 5, in <module> from beginner_tutorials.srv import AddTwoInts,AddTwoIntsResponse ImportError: cannot import name 'AddTwoInts' from 'beginner_tutorials.srv' (/home/sanjay/catkin_ws/devel/lib/python3/dist-packages/beginner_tutorials/srv/__init__.py)
I tried $source ./devel/setup.bash after running $catkin_make as per the recommendation from the past answers but still, the error is not resolved.
@Sanjay_KC, I assume you change nothing from the original tutorial code, I am right?. If you change something can you post your versions and Cmake to see if something is not properly implemented?
@Sanjay_KC, did you solve it? I have the same problem.
Had this exact issue running ROS Noetic on Windows 11 I solved this issue by editing the file : workspace/devel/lib/site-packages/srv/_addTwoInts.py All generated class names were generated as 'addTwoIntsRequest', 'addTwoInts', etc. when it was expected to be 'AddTwoIntsRequest', 'AddTwoInts', etc. so just change all 'a's in class names and other places to 'A' where it makes sense.