Re: newb questions re python-fu

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

 



Thanks very much, Chris.

I am using your file now and made a coupla repairs, afaict.
But it still doesnt install.  Now I may know why, as running
it straight up gives  No module named gimpfu!

I am on a Mac.  Did the gimp2.4.5...dmg not compile gimpfu?
Answer may be:  Look for a dot .so file:

find /Applications/Gimp.app/ -name gimpfu\*  |  grep \.so
/Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/python/gimpfu.py
/Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/python/gimpfu.pyc
/Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/python/gimpfu.pyo
                                   ==
false positive.

What should I do next?

paul
----

% cd /Users/paultaney/gimp/gimp-2.4.7/plug-ins/pygimp/plug-ins
% ./python-fu-Vanderwalt.py 
Traceback (most recent call last):
  File "./python-fu-Vanderwalt.py", line 20, in <module>
    from gimpfu import *  # imports the symbols gimp, pdb, register and main
ImportError: No module named gimpfu

----

> > Then I look for it under <Image>/Filters/Render/
>  and it is not there.

...is still the case.  I am also pushing it twice, like:
  % cp python-fu-vanderwalt.py ~/.gimp-2.4/plug-ins
  % chmod +x ~/.gimp-2.4/plug-ins/python-fu-vanderwalt.py
  % cp python-fu-vanderwalt.py ~/gimp/gimp-2.4.7/plug-ins/pygimp/plug-ins
  % chmod +x ~/gimp/gimp-2.4.7/plug-ins/pygimp/plug-ins/python-fu-vanderwalt.py


> >
> > <code>
> >
> >  RED, GRN, BLU = 0, 1, 2
> >  bluemask = (image[...,BLU] > 1.4*image[...,GRN])
> & \
> >             (image[...,BLU] > 1.4*image[...,RED])
> >
> >  blue_layer = gimp.layer(bluemask, width, height,
> RGBA_IMAGE, 100, NORMAL_MODE)
> >  image.addlayer(blue_layer, 0)
> >
> > </code>
> >
> > Q1) Is this even close?
> > Q2) can I continue to use numpy (as I was with
> wx.Python) or do these images have to be treated with scipy?
> 
> Hi Paul,
> 
> I found a few mistakes here and there.  The main one is
> that Python is
> very strict about indentation.  After that, the
> "import Interpolate"
> line I changed to "from scipy import interpolate as
> ma" - I'm not sure
> if that is correct or not.  Lastly, there were some items
> like
> "PF_ITEM("foo", _("foo"),
> "foo")" that I changed to
> "PF_ITEM("foo",
> "foo", "foo")" and also I added
> "Vanderwalt" to the end on the plug-in
> resgistration.  Oh yeah - I also added an 'except'
> in somewhere befor
> a "finally"...
> 
> So... now it still does not run correctly, but at least it
> registers
> with GIMP :|
> 
> BTW - starting GIMP from the command line will show syntax
> errors in
> py-fu scripts....  Also editors like scite and eric (among
> others)
> show indentation problems in Python by default - these are
> probably in
> your repositories.
> 
> HTH,
> Chris

Attachment: python-fu-vanderwalt.py
Description: Binary data

Attachment: Interpolate.py
Description: Binary data

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux