4

I have tried to write a service file in python using GDbus. But I could not find a good tutorial, only if i want to use C. Since I want to include GDbus in an existing Python code i have no idea how to do that.

It was possible for me to write a service file using dbus and I could access that service file with a GDbus client.

I would be very happy if somebody had a good example in Python. Thanks a lot, Dominik

1 Answers1

5

While you can use GDBus from Python, it might not be the nicest (most Pythonic) API to use, since it’s a C API which is mechanically introspected and exposed to Python.

You might be better off using pydbus, which is a modern D-Bus client library written for Python. Its documentation has plenty of examples in Python.

If you must use GDBus, here are some Python examples:

And here’s the GDBus API reference for Python (mechanically generated from the C API):

Philip Withnall
  • 5,293
  • 14
  • 28
  • Thanks for your fast answer. I have now looked a little bit into pydbus and it really looks a lot easier to use than GDBus. If I come to another big "unsolvable" problem for me I hope I can ask you again. – Dominik Möslinger Jan 15 '19 at 14:16