It’s the first time I’m using DBus so please bear with me.
This is my code:
import gobject
import pprint
gobject.threads_init()
from dbus import glib
glib.init_threads()
import dbus
bus = dbus.SessionBus()
remote_object = bus.get_object("org.freedesktop.UDisks", # Connection name
"/org/freedesktop/UDisks" # Object's path
)
print ("Introspection data:\n")
print remote_object.Introspect()
print remote_object.get_dbus_method("ListNames",dbus_interface="org.freedesktop.DBus")
for item in remote_object.ListNames():
print item
The error I’m getting is:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UDisks was not provided by any .service files
From the udisk-demon manpage
udisks-daemon provides the org.freedesktop.UDisks service on the system message bus. Users or administrators should never need to start this daemon as it will be automatically started by dbus-daemon(1) whenever an application calls into the org.freedesktop.UDisks service. See the udisks(7) man page for information on how to customize how udisks-daemon works.
EDIT: So it was SystemSession() and not SessionBus()
You can try using DFeet to check if this dbus object really exists.