D-Bus - 'ServiceUnknown' 调用远程过程时遇到异常

D-Bus - 'ServiceUnknown' exception encountered while calling a remote procedure

我正在尝试从我自己的程序中调用 Thunar 文件管理器的远程过程 DisplayFolderAndSelect()

import dbus
bus = dbus.SessionBus()
obj = bus.get_object('org.xfce.Thunar', '/org/xfce/FileManager')
iface = dbus.Interface(obj, 'org.xfce.FileManager')
_thunar_display_folder_and_select = iface.get_dbus_method('DisplayFolderAndSelect')
_thunar_display_folder_and_select('~/Downloads/', 'doc.pdf', '', '')

但是我在运行时遇到了以下异常:

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in call return self._proxy_method(*args, **keywords) File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in call **keywords) File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.576 was not provided by any .service files

我无法理解这个异常是什么意思。异常背后的原因是什么。

有什么想法吗?

我认为这是一个 OS 相关的问题,重启 D-Bus 服务解决了问题