Get object list in python
Andy Barry
astro9672 at yahoo.com
Thu Sep 17 14:44:41 PDT 2009
So it does. I must have had my introspection code wrong after all. I was using:
import dbus
bus = dbus.SystemBus()
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/AccessPoint')
iface = dbus.Interface(proxy, "org.freedesktop.DBus.Introspectable")
print dbus._expat_introspect_parser.process_introspection_data(iface.Introspect())
which returns "{}"
but when I change the path to /org/freedesktop/NetworkManager I get:
{u'org.freedesktop.NetworkManager.sleep': '', u'org.freedesktop.DBus.Introspectable.Introspect': '', u'org.freedesktop.NetworkManager.wake': '', u'org.freedesktop.NetworkManager.state': '', u'org.freedesktop.NetworkManager.GetDevices': '', u'org.freedesktop.NetworkManager.ActivateConnection': u'sooo', u'org.freedesktop.DBus.Properties.Get': u'ss', u'org.freedesktop.DBus.Properties.GetAll': u's', u'org.freedesktop.DBus.Properties.Set': u'ssv', u'org.freedesktop.NetworkManager.DeactivateConnection': u'o', u'org.freedesktop.NetworkManager.Sleep': u'b'}
in any case, you've solved my problem! Thank you very much!
Andy
--- On Thu, 9/17/09, Jesse Weinstein <jessw at netwood.net> wrote:
> From: Jesse Weinstein <jessw at netwood.net>
> Subject: Re: Get object list in python
> To: "dbus" <dbus at lists.freedesktop.org>
> Date: Thursday, September 17, 2009, 5:34 PM
> On Thu, 2009-09-17 at 14:01 -0700,
> Andy Barry wrote:
>
> > Once I know the numbers, I am able to get all of my
> data with little
> > trouble. However, I can't figure out how
> to get a list of the
> > available objects -- I tried Introspection but running
> an
> > introspection call on
> /org/freedesktop/NetworkManager/AccessPoint
> > did not return anything (I know the call was correct
> because it
> > worked with other paths).
> When I run:
> dbus.SystemBus().get_object('org.freedesktop.NetworkManager',
> '/org/freedesktop/NetworkManager/AccessPoint').Introspect(\
>
> dbus_interface='org.freedesktop.DBus.Introspectable')
>
> it gives me:
>
> <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object
> Introspection
> 1.0//EN"
> "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
> <node>
> <node name="12"/>
> </node>
>
> which means that there is one object path that is a child
> of the given
> object path,
> specifically:
> /org/freedesktop/NetworkManager/AccessPoint/12
>
> Do you get something different, or did you just not realize
> what the
> <node> elements meant? (I don't remember seeing it
> /documented/
> anywhere... ;-) )
>
> I found this out when I was working on my FullIntrospecter
> tool, which I
> mentioned on the list some time ago (to resounding
> silence).
>
> Jesse
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
More information about the dbus
mailing list