title: How to check bus.get_object returned object is valid for dbus in python?
body: <p>I have a python script which is enabling bluetooth discovery &amp; pairing. It using dbus to configure the bluetooth parameter. init code:</p>
  
  <pre><code>self.bus = dbus.SystemBus()
  self.bluez_obj = self.bus.get_object('org.bluez', '/org/bluez/hci0')
  self.bluetooth_props = dbus.Interface(self.bluez_obj,  "org.freedesktop.DBus.Properties")
  </code></pre>
  
  <p>I have seen that when I want to set the Bluetooth property by </p>
  
  <pre><code>self.bluetooth_props.Set(self.adapter_iface_name, "Discoverable", dbus.Boolean(value))
  </code></pre>
  
  <p>The method does not return from call.
  I am doubting that bus.get_object() call of dbus for this application didn't returned valid object.</p>
  
  <p>How can we check the get_object returned valid dbus object?</p>
  
  <p>[Edit]
  The issue started appearing recently, till now it was just working fine. this application started from the init.d during boot, and the discovery &amp; pair is enabled based on input events. get_object &amp; Interface is done in the application <em>init</em> only. after boot, when the input event received the utility is supposed to set timeout for Discovery &amp; pair.</p>
  
  <pre><code>self.bluetooth_props.Set(self.adapter_iface_name, "DiscoverableTimeout", dbus.UInt32(value))
  self.bluetooth_props.Set(self.adapter_iface_name, "PairableTimeout", dbus.UInt32(value))
  </code></pre>
  
  <p>This function does not return from the call which is directing me to doubt on the object created by get_object.
  Counter side, If I add delay of 1-3 Seconds before creating the object by get_object than its just work fine. So I guess when I am calling get_object without delay, there is no valid object returned might be because of the remote end(bluez stack i guess) is not ready.
  Adding delay resolves the issue but it may appear again as its just work around. I have checked change history, there is no change in init sequence or this application which is creating such issue.</p>
  
  <p>Any suggestions?</p>