Search code examples
pythonpython-2.7dbusxfcethunar

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


I'm trying to call the remote procedure DisplayFolderAndSelect() of Thunar file manager from my own program:

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', '', '')

However I've encountered the following exception at runtime:

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

I'm unable to understand what does this exception mean. And what's the cause behind the exception.

Any thoughts?


Solution

  • I think it is an OS-related issue, restarting D-Bus service solved the problem