GNOME Bugzilla – Bug 332622
Gimp python cannot be used if pygtk not installed against python
Last modified: 2008-01-15 14:05:56 UTC
Please describe the problem: For all gimp-python scripts included in Gimp distribution, a message 'gobject cannot be found' is printed to the console Steps to reproduce: 1. Install pygtk in a non-standard directory (anything but python site-packages) 2. Build gimp with python support (default) 3. Start Gimp with PYTHONPATH set to the pygtk location Actual results: Python exception for gobject not found from gimpenums; thus no gimp python extensions are available. Expected results: Gimp python scripts should be available Does this happen every time? Yes Other information: In fact, pygtk samples on pygtk site all contain the following sequence: import pygtk pygtk.require('2.0') import gobject Testing it directly with the python interpreter works well. The pygtk-2.0 will load automatically as default only if: 1st) installed pygtk in standard python directory 2nd) pygtk.pth isn't modify to contain something else than gtk-2.0 Gimp python extensions should probably require the Gtk version before trying to load the gobject.
Here is the complete python exception (it occurs 10 times, one per .py file): Traceback (most recent call last):
+ Trace 66536
from gimpfu import *
from gimpenums import *
from _gimpenums import *
Note that adding the following lines in gimpemuns.py just before 'from _gimpenums import *' solve the issue (I don't know how to patch gimpenumsmodule.c) import pygtk pygtk.require('2.0')
I added it the C level, since gimpcolor needs it too. 2006-02-28 Manish Singh <yosh@gimp.org> * plug-ins/pygimp/Makefile.am * plug-ins/pygimp/pygimp-util.h: New file, provides only an initialization wrapper for now (pygimp_init_pygobject). * plug-ins/pygimp/gimpcolormodule.c * plug-ins/pygimp/gimpenumsmodule.c: Use pygimp_init_pygobject here. Closes bug #332622.