Sorry all, this is a repeat email that got caught up in the spam filtering 
system. I already had some responses earlier (after I joined the mailing list).


On 2018-03-06, 1:36 PM, "python-hackers-list on behalf of Hayden Lau" 
< on behalf of> 

    [This sender failed our fraud detection checks and may not be who they 
appear to be. Learn about spoofing at]
    I understand this is a dev mailing list, but I’m not sure where to post 
this question otherwise.
    I’m attempting to write an application that interacts with UDisks2 over 
DBus with PyGObject. However, I’m finding that after instantiating the proper 
Gio.DBusObjectManagerClient, I seem to be unable to get updates on the 
ObjectManager’s state. Am I missing something? The only example code that I 
could find that had similar functionality was in udiskie 
(, but that application uses Gio.DBusProxy 
directly. Is that the recommended approach? My (non-working) proof of concept 
code pasted below. It prints the initial set of objects reported by the 
‘org.freedesktop.UDisks2’ object manager, but does not print changes (either 
via signal or polling) when disks are added or removed.
    Thank you,
    Hayden Lau
    from time import sleep
    import gi
    gi.require_version('Gio', '2.0')
    from gi.repository import Gio
    udisks2 = Gio.DBusObjectManagerClient.new_for_bus_sync(
    def new_obj_handler(obj):
        print('New Object: ', obj)
    def new_iface_handler(obj):
        print('New Interface: ', obj)
    def get_paths(objmgr):
        return [obj.get_object_path() for obj in objmgr.get_objects()]
    udisks2.connect('interface-added', new_iface_handler)
    udisks2.connect('object-added', new_obj_handler)
    paths = []
        if paths != get_paths(udisks2):
            paths = get_paths(udisks2)
    python-hackers-list mailing list

python-hackers-list mailing list

Reply via email to