2010-12-10 58 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 
*/ 

回答

相關問題