2010-12-10 59 views
1

我试图锁定我的GNOME屏幕保护程序,但是dbus .Lock方法正在等待响应。我想它不是等待回应(只需发送信号锁定屏幕保护程序,并继续与生活)。我该怎么做呢? (实际上这个代码是在一个线程中,所以我继续生活,但我仍然得到令人讨厌的错误)在不阻塞的情况下调用代理服务器方法

session_bus = dbus.SessionBus()                                  
screensaver_proxy = session_bus.get_object('org.gnome.ScreenSaver', '/org/gnome/ScreenSaver')                                                                                                                              
locked = screensaver_proxy.Lock(dbus_interface='org.gnome.ScreenSaver') 
print "HELLO" # will never get called, due to: 
/* 
    locked = screensaver_proxy.Lock(dbus_interface='org.gnome.ScreenSaver') 
    File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__ 
    return self._proxy_method(*args, **keywords) 
    File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__ 
    **keywords) 
    File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking 
    message, timeout) 
    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 
*/ 

回答

相关问题