This question has an answer for roscpp; what is the equivalent solution for Python?
EDIT: I do not want to wait for the service. I want to take one action if the service exists and a different action if it doesn't exist.
A hack might be to wrap a wait_for_service call in a try/catch to catch a ROSException and verify that that ROSException was a timeout, but that's very ugly and I'm not sure what the minimum required timeout should be to ensure that extant topics do not cause the Exception.
Originally posted by BJP on ROS Answers with karma: 100 on 2017-06-01
Post score: 1