[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Weechat-dev] [bug #31091] python plugin: import gtk throws error

From: Obada Mahdi
Subject: [Weechat-dev] [bug #31091] python plugin: import gtk throws error
Date: Wed, 19 Nov 2014 18:20:45 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36

Follow-up Comment #8, bug #31091 (project weechat):

I can reproduce the this problem on my Fedora 21 based system, using
 * WeeChat 1.0.1, ncurses client
 * PyGTK version 2.24.0
 * Python 2.7.8
 * "anotify.py" script, version 1.0.1
when reloading "anotify" (as described in comment #6).

@SebastiƩn: Which version of lnotify have you been using?  It seems that
lnotify has changed and does not use pynotify anymore, at least not since
version 0.2.0.

This problem is related to the use of Python sub-interpreters, which seem to
have trouble with native modules like gtk._gtk that modify the module
directory as part of their initialization code:

It seems like dynamic objects (_gtk.so) are loaded only once per _process_,
which is why the initialization code is not re-run the second time the import
is triggered (by importing pynotify, which imports gtk, which imports _gtk),
and thus the module directory of the new interpreter state is not populated
with the "gdk" module.  Comment #6 was on the right track suspecting the
"weird magic" that is involved in loading "gdk", and that there is at least
_something_ on the WeeChat side (using sub-interpreters within a single
process) that triggers this bug (gtk being unable to find the "virtual" gdk

This bug will also be triggered if two more more different Python scripts are
are importing the "gtk" module -- only the first one will succeed.

However, if anything, it can be considered a bug in Python, or in the
implementation details of PyGTK (not allowing for proper reloading), but it is
definitely not a bug in WeeChat.  I am not sure if there is a workaround that
does not involve chancing either Python or PyGTK.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]