[Libosinfo] [PATCH libosinfo] examples: avoid PyGIWarning

Guido Günther agx at sigxcpu.org
Sat Oct 29 20:42:35 UTC 2016


This fixes

demo.py:3: PyGIWarning: Libosinfo was imported without specifying a version first. Use gi.require_version('Libosinfo', '1.0') before import
to ensure that the right version gets loaded.
  from gi.repository import Libosinfo as osinfo;
---
 examples/demo.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/demo.py b/examples/demo.py
index bdc9b9a..afd3e7c 100755
--- a/examples/demo.py
+++ b/examples/demo.py
@@ -1,5 +1,7 @@
 #!/usr/bin/python
 
+import gi
+gi.require_version('Libosinfo', '1.0')
 from gi.repository import Libosinfo as osinfo;
 
 loader = osinfo.Loader()
-- 
2.9.3




More information about the Libosinfo mailing list