Re: Restarting connection with dbus



On Wed, 2006-10-25 at 01:08 -0400, Dan Williams wrote:
> Once you've found it, use the setActiveDevice method call.  Its
> arguments are:
> 
> If wired:
> 1) DBUS_TYPE_OBJECT_PATH: path of device to activate

I'm using wired here, it works but I get an exception. This is a bit
strange. I'm getting the following exception:

Traceback (most recent call last):
  File "test.py", line 20, in ?
    nm.setActiveDevice(op)
  File "/var/lib/python-support/python2.4/dbus/proxies.py", line 102, in
__call__
    reply_message = self._connection.send_with_reply_and_block(message,
timeout)
  File "dbus_bindings.pyx", line 455, in
dbus_bindings.Connection.send_with_reply_and_block
dbus_bindings.DBusException: NetworkManager::setActiveDevice called with
invalid arguments.

My script looks like this:

#!/usr/bin/python
import dbus

NM_DBUS_SERVICE = "org.freedesktop.NetworkManager"
NM_DBUS_INTERFACE = "org.freedesktop.NetworkManager"
NM_DBUS_OPATH = "/org/freedesktop/NetworkManager"

bus = dbus.SystemBus()
nm_obj = bus.get_object(NM_DBUS_SERVICE, NM_DBUS_OPATH)
nm = dbus.Interface(nm_obj, NM_DBUS_INTERFACE)

devices = nm.getDevices()

for op in devices:
    dev_obj = bus.get_object(NM_DBUS_SERVICE, op)
    dev = dbus.Interface(dev_obj, NM_DBUS_INTERFACE)
    props = dev.getProperties()
    
    if props[4] == True:
        nm.setActiveDevice(op)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]