2

In-place upgraded from 12.04 to 12.10, and Python import gtop stopped working.

python-gtop 2.32.0+dfsg-1 (amd64 binary) in ubuntu quantal says Superseded

Installing python-gnomedesktop and python-gnome2-desktop-dev did not help.

Where are the Python libgtop bindings for ubuntu quantal?

3 Answers 3

5

You need to use the introspected bindings for new versions of glib-based libraries. In this case, you need to install the gir1.2-gtop-2.0 package, and use from gi.repository import GTop to access the APIs.

8
  • Looks like gir1.2-gtop-2.0 was already installed, and Python can find GTop using that import. Thanks - I'll go udpate my scripts.
    – igouy
    Jan 2, 2013 at 16:54
  • Now where can I find some documentation? The scripts don't work when I use from gi.repository import GTop.
    – igouy
    Jan 4, 2013 at 22:53
  • 1
    Unfortunately, use of introspected APIs is not well documented, and can vary a bit across languages. The C documentation developer.gnome.org/libgtop/stable is a generally good starting point though. You can install libgtop2-doc to get a local copy, and libgtop2-dev to look at header files, and the GTop-2.0.gir file in /usr/share/gir-1.0/ to look for a bit more details on how some APIs are introspected. If they are flagged introspected="0" then they are not available to use in Python.
    – dobey
    Jan 5, 2013 at 14:21
  • Is there a way to use the old static bindings gtop API? What would I risk breaking?
    – igouy
    Jan 8, 2013 at 18:47
  • You can use the static bindings as long as they remain available in the archive. However, you cannot mix static and introspected bindings. If the bindings aren't in the archive, you'd need to build them yourself. It is recommended to migrate if you wish to support newer versions.
    – dobey
    Jan 8, 2013 at 19:55
2

Everything is moving from static bindings to dynamic bindings through GObject-Introspection.

You should use the gir1.2-gtop-2.0 package and probably the C-reference for development.

0

The gnome wiki provides some information about introspection porting.

I found more information by playing around like this --

> python
> from gi.repository import GTop
> help(GTop)

> help(GTop.glibtop_proc_mem)

> help(GTop.glibtop_proc_mem().resident)

but still not enough to make porting my scripts straightforward.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .