[libvirt] [libvirt-sandbox PATCH] Silence PyGIWarnings

Guido Günther agx at sigxcpu.org
Fri Mar 18 17:32:21 UTC 2016


This fixes

/usr/bin/virt-sandbox-service:22: PyGIWarning: LibvirtGObject was imported without specifying a version first. Use gi.require_version('LibvirtGObject', '1.0') before import to ensure that the right version gets loaded.
  from gi.repository import LibvirtGObject
/usr/bin/virt-sandbox-service:23: PyGIWarning: LibvirtSandbox was imported without specifying a version first. Use gi.require_version('LibvirtSandbox', '1.0') before import to ensure that the right version gets loaded.
  from gi.repository import LibvirtSandbox
---
 bin/virt-sandbox-service | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index a4a2154..45f4517 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -19,7 +19,10 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
+import gi
+gi.require_version('LibvirtGObject', '1.0')
 from gi.repository import LibvirtGObject
+gi.require_version('LibvirtSandbox', '1.0')
 from gi.repository import LibvirtSandbox
 from gi.repository import GLib
 import gi
-- 
2.7.0




More information about the libvir-list mailing list