PDA

View Full Version : Python and gimpfu



ravindra.rajaram
April 27th, 2008, 10:06 AM
I'm trying to do something with Python and the gimpfu package.
Here is the sample code.

#!/usr/bin/python
import sys
try:
sys.path.append("/usr/lib/gimp/2.0/python/")
from gimpfu import *
img = gimp.Image(420,300,RGB)
gimp.Display(img)
except ImportError:
print "Could not import gimpfu package"



When I execute this with GIMP's "Python-fu"console, things are fine.
But, when I run the same program in a shell (after saving the code in a file)
I get the message below:

LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not been initialized
aborting...
Aborted (core dumped)

Any explanation for this behavior? It appears that some initializations performed by Script-Fu are missing in the stand-alone execution on the python code.
How can I make this work when I run this stand-alone?

Thanks,
RR

ravindra.rajaram
May 4th, 2008, 04:39 PM
Did I post my query in the wrong area??
If so, can some one redirect me please??

Thanks,
RR

saulgoode
May 4th, 2008, 06:49 PM
I don't use Python with GIMP but you might find your answers in this gimp.org document (http://www.gimp.org/docs/python/index.html).

ravindra.rajaram
July 6th, 2008, 04:33 AM
Been busy for sm time..thx for the response..
I'll look for more details in the doc.

Thanks,
RR

sivakrishna
August 2nd, 2008, 09:40 AM
It worked when I run this in python console within GIMP.