problems importing from /usr/lib/pyshared/
dieter at handshake.de
Sat Jan 12 08:08:30 CET 2013
Harold <dadapapa at googlemail.com> writes:
> I recently upgraded my system from ubuntu 11.4 to 12.4 and since run into an issue when trying to import several packages in python2.7, e.g.
> harold at ubuntu:~$ python -c 'import gtk'
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py", line 30, in <module>
> import gobject as _gobject
> File "/usr/share/pyshared/gobject/__init__.py", line 26, in <module>
> from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \
> File "/usr/share/pyshared/glib/__init__.py", line 22, in <module>
> from glib._glib import *
> ImportError: No module named _glib
Ubuntu 12 has introduced important changes with respect to "glib" (and
depending packages). In fact, there are now two quite incompatible
implementations - the old "static" one and a new "dynamic" one.
It looks as if in your case, old and new implementations were mixed.
I had a similar problem when upgrading to "Ubuntu 12.4". In my case,
it turned out that my (custom) "PYTHONPATH" setting was responsible for
getting into the incompatibility.
The new way to use "gtk" is via the "gi" (probable "gnome interface")
module. It looks like:
from gi.repository import Gtk,GdkPixbuf,GObject,Pango,Gdk,Gio
More information about the Python-list