You have been subscribed to a public bug: Seen on Ubuntu 20.04 libgtk-3-0 version 3.24.20
Use case ======== We want to check if Gtk is available without actually using it. Once we confirm that it is available we can start using it, or take another route if it is unavailable. Steps to reproduce ================== The display must be unset, which is the default behaviour when ssh:ing to a machine. Then import Gtk in Python to get the error message. cendio@ubuntu2004:~$ DISPLAY= python3 Python 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import gi >>> gi.require_version("Gtk", "3.0") >>> from gi.repository import Gtk Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused Expected result =============== Importing Gtk should not give error messages. In Ubuntu 22.04, this issue is not present: cendio@ubuntu-22:~$ DISPLAY= python3 Python 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import gi >>> gi.require_version("Gtk", "3.0") >>> from gi.repository import Gtk Other comments ============== Aside from the error message, everything seem to be working as expected. The errors are not Gtk errors, so it is unclear how they can be silenced. ** Affects: gtk+3.0 (Ubuntu) Importance: Undecided Status: New -- Importing Gtk in Python without a valid DISPLAY gives error message https://bugs.launchpad.net/bugs/1988536 You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gtk+3.0 in Ubuntu. -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs