PyGobject GTK app doesn't start without DBus session-bus even though the app doesn't use dbus

Viewed 53

So, I made a notes app in Python using PyGobject. It's all well and cool, except it absolutely refuses to start up if I take away its' dbus permissions.

While it wouldn't be a huge problem if I packaged it as a deb or something, it is since I'm packaging it as a flatpak (intending to publish it on flathub later). I packaged it up into a .flatpak, and it works fine, but if I take away socket=session-bus, I just get this instead of my app:

Failed to register: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown

I looked far and wide for anyone with the same issue, but to no avail, I didn't even find anything describing a remotely similar one. PyGobject doesn't even mention DBus in their documentation!

I didn't (knowingly) touch anything related to dbus in my app's code, and I don't know how to capture dbus traffic going to my app (no I did try googling). I also tried out D-Spy gnome app but the entry for my app there shows up so briefly I don't get enough time to click on it before it disappears.

I created a 15 lines big scriptlet which reproduces my issue:

import gi
from gi.repository import GLib

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class Application(Gtk.Application):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, application_id="com.example.example", **kwargs)

if __name__ == "__main__":
    app = Application()
    app.run()
    Gtk.main()

At this point I'm clueless, and looking for help from anyone. You can take a look at my source code here. Thanks for anyone looking into my issue.

1 Answers

After an intensive stripping of code, I found out what part makes it depend on DBus. I have no idea why, but this little change solved the problem.

basically this:

 super().__init__(*args, application_id="com.example.vnotes", **kwargs)

changes to this:

 super().__init__(*args, **kwargs)

and it works suddenly now!

Related