Active Topics

 


Reply
Thread Tools
laasonen's Avatar
Posts: 565 | Thanked: 618 times | Joined on Jun 2010 @ Finland
#1
How to not to ask for a reply? Thanks.
Code:
import dbus
bus = dbus.bus.BusConnection("unix:path=/var/run/dbus/system_bus_socket")
object = bus.get_object('com.nokia.mce', '/com/nokia/mce/request')
interface = dbus.Interface(object, dbus_interface='com.nokia.mce.request')
interface.devlock_callback(dbus.Int32("2"))
Code:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.5/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
 
Posts: 235 | Thanked: 339 times | Joined on Nov 2010
#2
Apparently you're supposed to set error_handler and reply_handler to None. When I did that, though, it didn't send the message.

I worked around it like this:
Code:
import dbus

bus = dbus.bus.BusConnection("unix:path=/var/run/dbus/system_bus_socket")
object = bus.get_object('com.nokia.mce', '/com/nokia/mce/request', introspect=False)
interface = dbus.Interface(object, dbus_interface='com.nokia.mce.request')
try:
	interface.devlock_callback(dbus.Int32("2"), timeout = 0)
except dbus.exceptions.DBusException:
	pass
 

The Following User Says Thank You to jstokes For This Useful Post:
laasonen's Avatar
Posts: 565 | Thanked: 618 times | Joined on Jun 2010 @ Finland
#3
Originally Posted by jstokes View Post
Apparently you're supposed to set error_handler and reply_handler to None. When I did that, though, it didn't send the message.

I worked around it like this:
Code:
import dbus

bus = dbus.bus.BusConnection("unix:path=/var/run/dbus/system_bus_socket")
object = bus.get_object('com.nokia.mce', '/com/nokia/mce/request', introspect=False)
interface = dbus.Interface(object, dbus_interface='com.nokia.mce.request')
try:
	interface.devlock_callback(dbus.Int32("2"), timeout = 0)
except dbus.exceptions.DBusException:
	pass
Thanks again, sorry for my poor dbus skills
 

The Following User Says Thank You to laasonen For This Useful Post:
Posts: 875 | Thanked: 918 times | Joined on Sep 2010
#4
In C you would create a "method call" message, append the args and then call dbus_message_set_no_reply(message, TRUE) before sending it.

It looks like Python has a set_no_reply(message, bool) method that might do the same.

http://dbus.freedesktop.org/doc/dbus...age-class.html
 
Reply


 
Forum Jump


All times are GMT. The time now is 07:03.