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

I have a Python application that ran without problem on 12.10, but on upgrading to 13.04 the application fails with the following error :

except gi._glib.GError, e:

AttributeError: 'module' object has no attribute 'GError'

Is there a change in the Python 2 Gtk libraries associated with 13.04 ?

share|improve this question
Did you write the application? If not, where does it come from? – Jennifer Wilson Apr 27 '13 at 9:40

Functions, methods, attributes, etc with an underscore are used as internal methods in Python. These can change or deleted without warning, so it's better to never use these outside that package.

Try the following:

>>> from gi.repository import GObject, GLib
>>> GObject.GError
<class 'gi._glib.GError'>
>>> GLib.GError
<class 'gi._glib.GError'>

This also works on Ubuntu 12.10 and possibly earlier.

share|improve this answer

This import error occurs on Ubuntu 14.04, but not on Ubuntu 12.04. Basically due to the transition from Python 2.x -> Python 3. Many modules were renamed or merged. Python 3 is NOT backward compatible with Python 2.x. So add this to the list of the gotchas.

ImportError: No module named 'gi._glib' bugreport #705387

from gi._glib import GError


from gi.repository.GLib import GError
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.