While running some older Python+GTK3 code under Ubuntu 14.04, the following deprecation warnings appeared:
PyGIDeprecationWarning: io_add_watch is deprecated; use GLib.io_add_watch instead
/usr/lib/python3/dist-packages/gi/overrides/GLib.py:655: PyGIDeprecationWarning: Calling io_add_watch without priority as second argument is deprecated
/usr/lib/python3/dist-packages/gi/overrides/GLib.py:666: PyGIDeprecationWarning: Calling io_add_watch with priority keyword argument is deprecated, put it as second positional argument
This comes from a line where GObject.io_add_watch()
is called.
From http://www.piware.de/2012/11/pygobject-3-7-2-released/ and http://lazka.github.io/pgi-docs/api/GLib_2.0/functions.html?highlight=add_watch#GLib.io_add_watch it looks like the parameter profile for GLib.io_add_watch()
is different from GObject.io_add_watch()
. So now I'm wondering:
- what is the correct way to set an I/O watch on an fd in Python+GTK3? Which function to use, what parameter profile to use?
- how can I write the code in a way that it is compatible with older systems, eg. Ubuntu 12.04?
Can anyone with experience with this API in old and new systems give some hints?