Is there any example on how to capture udev events in Python3? I can't get events working at all in .237 (or 1.0?). And couldn't get any examples of GUdev with Introspection.
I'm not sure where the problem lies. I found an example test.py but there, parameters are given when instantiating Client like in client = GUdev.Client(['block']). Those parameters are not accepted in the actual version (TypeError: GObject.__init__() takes exactly 0 arguments (1 given)).
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GUdev', '1.0')
from gi.repository import Gtk, GUdev, GLib
def on_uevent(client, action, device):
print(action)
client = GUdev.Client()
client.connect('uevent', on_uevent)
GLib.MainLoop().run()
Ah, well. Seems the G(NU|nome|object)-Introspection changed a few things in its workings.
works fine (Note the addition of
.new). I don't know why the old syntax (see above) doesn't throw any errors...BTW,
GUdev.Client.new(['block'])accepts multiple values in the list.