After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332622 - Gimp python cannot be used if pygtk not installed against python
Gimp python cannot be used if pygtk not installed against python
Status: VERIFIED FIXED
Product: GIMP
Classification: Other
Component: Gimp-Python
2.3.x
Other All
: Normal normal
: ---
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-02-26 12:59 UTC by Eric Lamarque
Modified: 2008-01-15 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Eric Lamarque 2006-02-26 12:59:19 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.
Comment 1 Eric Lamarque 2006-02-26 20:49:09 UTC
Here is the complete python exception (it occurs 10 times, one per .py file):

Traceback (most recent call last):
  • File "/mnt/windows/eric/newgimp/bindev/lib/gimp/2.0/plug-ins/sphere.py", line 21 in ?
    from gimpfu import *
  • File "/mnt/windows/eric/newgimp/bindev/lib/gimp/2.0/python/gimpfu.py", line 66 in ?
    from gimpenums import *
  • File "/mnt/windows/eric/newgimp/bindev/lib/gimp/2.0/python/gimpenums.py", line 24 in ?
    from _gimpenums import *
ImportError: could not import gobject

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')
Comment 2 Manish Singh 2006-03-01 01:09:41 UTC
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.