[Gimp-user] Debugging register function for registration of a python plugin under Windows XP



Obviously, normal fault-hunting can be done via gimp.pdb.message(someMessage)
once a plugin is successfully registered. Windows/Dockable dialogs/Error console
is obviously very helpful once an extension is up-and-running, HOWEVER I found
registration fairly trying and had a number of problems getting this to work
with basically no feedback about what I might be doing wrong. Ideally, getting
started should be the easiest part of the process, not the hardest. Thanks for
posting the guide. I'll definitely consider using that approach in future. I
came across an alternative which you may consider adding (though I haven't
compared the techniques for getting error-output so I don't know which one is
better).

Anyways, for the reference of other users developing GIMP Pythonfu plugins under
Windows, I'll repeat some information which I found very helpful when I was
searching. At the very top of the .py file, it's can be useful to do something
like:

import sys
sys.stderr = open("C:\\tmp\\errs.txt",'a')

This will cause the python environment to show some otherwise-hidden startup and
register-registration errors by outputting / printing them to the specified
location. The example I saw used mode 'a' to append errors, rather than
overwrite. Doing this allowed me to spot a mistake I was making.

In addition, one can also do

import sys
sys.stout = open("C:\\"tmp\\msgs.txt",'a')

if it's more convenient to receive output this way.


Additionally, Toolbox-prefix category is deprecated (since at least Gimp 2.6).
you
should be putting your menu entry in Image-prefix category (the window
displaying
the current image), or in Layers-prefix category (the right-click menu in the
layers list), but the latter requires your plug-in to take image and drawable
parameters.
Can you link to where this deprecation is publicly documented? The information
available on GIMP Python-fu is often out-of-date and extremely disparate, I've
found. Even http://www.gimp.org/docs/python/ is out of date in some respects, at
least comparing it stylistically to some examples I've seen here and elsewhere.
It would be helpful to know what calls are deprecated or now broken between
versions so users will have some idea of whether they're looking at an outdated
(and possibly broken or unreliable) way of doing things.

Your response also makes me wonder what of the other plugin-categories are (the
ones that get specified in angle brackets) still work, and what their
requirements are. An (outdated?) list of them I wrote down at some point went:
"Toolbox", "Image", "Layers", "Channels", "Vectors", "Colormap", "Load", "Save",
"Brushes", "Gradients", "Palettes", "Patterns" or "Buffers".

Thanks!

-- 
SeldomNeedy (via www.gimpusers.com/forums)


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