Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
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 '13 at 16:54
Please accept this as the answer then. Thanks. – dobey Jan 2 '13 at 21:34
Now where can I find some documentation? The scripts don't work when I use from gi.repository import GTop. – igouy Jan 4 '13 at 22:53
Unfortunately, use of introspected APIs is not well documented, and can vary a bit across languages. The C documentation 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 '13 at 14:21
Is there a way to use the old static bindings gtop API? What would I risk breaking? – igouy Jan 8 '13 at 18:47

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.