[pygtk] ImportError in pygtk-2.16.0
Stephen George
steve_geo at optusnet.com.au
Sun Apr 11 06:34:35 WST 2010
Hossein Movahhedian wrote:
> On 04/10/2010 04:59 PM, Rafael Villar Burke (Pachi) wrote:
>
>> On 10/04/2010 10:12, Hossein Movahhedian wrote:
>>
>>> Dear all,
>>> Hi
>>> I have installed pygtk-2.16.0, pygobject-2.20.0 successfully
>>> on slackware-13.0. These packages are used by my network manager
>>> wicd-1.7.0. While other packages used by wicd (e.g. urwid-0.9.9.1,
>>> dbus-python-0.83.1, and pycairo-1.8.8) work properly, I get an
>>> error message with pygtk and pygobject which is listed at the end
>>> of this message.
>>>
>>> Any help would be gratefully appreciated.
>>>
>>> Thanks
>>>
>>> Please note that `/usr/local' is linked to `/ext3/local/13.0'
>>>
>>> $ wicd-client
>>> /usr/local/Python/lib/python2.6/site-packages/gtk-2.0/gtk/__init__.py:40:
>>> RuntimeWarning:
>>> tp_compare didn't return -1 or -2 for exception
>>> from gtk import _gtk
>>> ImportError: could not import gio
>>> ImportError: could not import gio
>>> Traceback (most recent call last):
>>> File "/usr/local/Python/share/wicd/gtk/wicd-client.py", line 64, in
>>> <module>
>>> import gui
>>> File "/ext3/local/13.0/Python-2.6.2/share/wicd/gtk/gui.py", line 32,
>>> in<module>
>>> import gtk.glade
>>> ImportError: cannot import name Widget from gtk
>>>
>> I think your problem is that you need to install libglade support for
>> gtk and their pygtk bindings, as libglade is not part of pygtk or gtk
>> itself.
>>
>
> Many thanks for your reply.
> libglade-2.6.4 is already installed on slackware 13.0.
>
>
>> Also, the recommended way now is to use gtk.Builder (which is part of
>> gtk+ itself) instead of libglade, so I'd consider switching.
>>
>
> Unfortunately I don't know how to do this. Is there any patch to do this?
>
> Yours
> Hossein Movahhedian
>
Personally I don't think glade installation was your problem, .. But
moving to GtkBuilder for either new or ongoing apps is a good move,
libglade will drop along the wayside.
GtkBuilder has been out for a while now. I know a number of large apps
that has completed the porting effort to remove the dependency on libglade.
for some background on GtkBuilder
http://www.micahcarrick.com/05-30-2008/gtk-builder-libglade-faq.html
then have a look at his tutorial
http://www.micahcarrick.com/01-01-2008/gtk-glade-tutorial-part-3.html#2
Of course reference the documentation
http://www.pygtk.org/docs/pygtk/class-gtkbuilder.html
Then use Google to find other tutorials and other references.
You have not stated if other pyGTK applications work on your system or
not, i.e. is it a system problem or is it a problem in your app.
I find it suspicious that the trace back shows gtk __init__.py is having
problems importing gio
Good luck
Steve
More information about the pygtk
mailing list