[virt-tools-list] [osinfo PATCH] Use GObject from gi.repository in demo.py

Daniel P. Berrange berrange at redhat.com
Wed Nov 30 13:41:44 UTC 2011


On Wed, Nov 30, 2011 at 11:10:40AM +0100, Christophe Fergeau wrote:
> Otherwise it fails to run with:
> 
> Traceback (most recent call last):
>   File "examples/demo.py", line 4, in <module>
>     from gi.repository import Libosinfo as osinfo;
>   File "/usr/lib64/python2.7/site-packages/gi/__init__.py", line 23, in <module>
>     from ._gi import _API, Repository
> ImportError: could not import gobject (error was: ImportError('When using
> gi.repository you must not import static modules like "gobject". Please
> change all occurrences of "import gobject" to "from gi.repository import
> GObject".',))
> ---
>  examples/demo.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/examples/demo.py b/examples/demo.py
> index ac09ae7..8cab020 100755
> --- a/examples/demo.py
> +++ b/examples/demo.py
> @@ -1,6 +1,6 @@
>  #!/usr/bin/python
>  
> -import gobject
> +from gi.repository import GObject
>  from gi.repository import Libosinfo as osinfo;

It doesn't actually look like we need to import gobject at all. I don't
see it used anywhere in the demo. It is probably a legacy import which
can be removed.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list