Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New python-fu plugins are not registering
#1
Greetings all,

I am a veteran programmer, but new to scripting for GIMP. I've hit a roadblock that had me legit stumped, so I'm looking for someone with expertise in the domain.

The python console in GIMP works just fine and other python scripts that ship with GIMP (e.g., foggify.py) work as expected, but I have not been able to even get a Hello World python-fu script to run. (This is a fresh install of GIMP 2.10 on Windows 10.) I've exhausted every reference, tutorial and troubleshooting guide I can find, and apparently I'm still missing something.

Notably, I can copy foggify.py, change all relevant instances of "fog*" to "dog*", save it in the same directory as doggify.py, and it is not recognized by GIMP. However, I can make changes to foggify.py (e.g., change the menu text from "_Fog..." to "_Frogs..." and that IS recognized by GIMP. Apparently I'm missing some aspect of registration.

Attached is a .zip of C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\foggify, including a text file with the output of a --verbose startup.

Any suggestions would be most appreciated.


Attached Files
.zip   foggify.zip (Size: 7.9 KB / Downloads: 358)
Reply
#2
Update: Plugins seem to be recognized, but only when placed in C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins

I'm still not sure what I was missing in getting scripts to register in C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\, but... oh well.
Reply
#3
Not sure either, glad it works(*). Something else is suspicious in your startup log: it is re-registering the DarkTable and RawTherapee plugins. Normally, plugins registrations are kept in the pluginrc file (in the Gimp user profile) together with the modification timestamp of the corresponding executable. If on startup the executable exists and its file timestamp hasn't changed, then the previous registration is assumed to be still valid and the plugin is not called. So did you do something with these two plugins?  

(*) About C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins (the user profile) or C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\ (the installation directory): initially it was mostly a matter of installing for all users v.s. installing for a specific user without impacting others. These days where most systems are single-user this is less important, but the installation directory is more likely to be wiped out by a reinstall, while the user profile is more likely to be part of backups, so your manually installed scripts and plugins (and other add-ons: brushes, gradients...) are a bit more at home in the user profile. Note that you can also use Edit>Preferences>Folders to add folders to the list of folders checked for plugins on startup. This can allow you to use a more editor-friendly directory while you work on your plugins.
Reply
#4
(11-09-2018, 11:18 PM)Ofnuts Wrote: Not sure either, glad it works(*). Something else is suspicious in your startup log: it is re-registering the DarkTable and RawTherapee plugins. Normally, plugins registrations are kept in the pluginrc file (in the Gimp user profile) together with the modification timestamp of the corresponding executable. If on startup the executable exists and its file timestamp hasn't changed, then the previous registration is assumed to be still valid and the plugin is not called. So did you do something with these two plugins?  

(*) About C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins (the user profile) or C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\ (the installation directory): initially it was mostly a matter of installing for all users v.s. installing for a specific user without impacting others. These days where most systems are single-user this is less important, but the installation directory is more likely to be wiped out by a reinstall, while the user profile is more likely to be part of backups, so your manually installed scripts and plugins (and other add-ons: brushes, gradients...) are a bit more at home in the user profile. Note that you can also use Edit>Preferences>Folders to add folders to the list of folders checked for plugins on startup. This can allow you to use a more editor-friendly directory while you work on your plugins.

Hello,
Gimp 2.10
Strange, the example of fogify dogify is a superb example, that there is something going on very strange

I got Dog in the decors Filter menu just above Fog , and Dog seems to work the same as Fog

now trying to change Decprs to PKHG and indeed, it occurs with Dog BUt under Dececors still Fog is seen

strange strange strange
Reply
#5
One thing that hasn't been mentioned so far is that it's now expected that plug-ins get put into a directory with the name name as the plugin, so fogify.py is in a directory named plugins/fogify. you can't put another script with a different name into the fogify directory and expect it to work.

You can still put it up one level into the plugins directory.

BUT, as ofnuts says, expect to loose anything personal you put into the installation directories when GIMP is next upgraded.
Reply
#6
Hi hi,
discovered yesterday,
I have (had) several gimp installations (e.g. the 99 version) and all those have a foggify.py and
2.10 seems to find those files and installs them my personal plugin looks at this moment like
c:/Users/Eigenaar/AppData/Roaming/GIMP/2.10/plug-ins:
 drwxrwxrwx  1 Eigenaar Geen 4096 02-05 17:09 doggify

  -rw-rw-rw-  1 Eigenaar Geen 6798 11-09 17:06 gimp_a_generate_bars.py

and in doggify.py I have
 menu="<Image>/PKHG",  and (finally) PKHG occurs where I want it to show up (the list of tabs left of Fillters)

So that is understood  Wink

My biggest wish at this moment to revive  arakneguideLab.py  (even in a more extended version)

Will try the idea that a plugin   myplugin must be put into an direcectory c:/Users/Eigenaar/AppData/Roaming/GIMP/2.10/plug-ins/myplugin/myplugin.py

Will tell if succeeded ;-)

A basic arakne-guide-lab.py WORKS again (using by the way gtk ;-)
Reply
#7
(02-06-2021, 06:41 AM)opaPeter Wrote: my personal plugin looks at this moment like
c:/Users/Eigenaar/AppData/Roaming/GIMP/2.10/plug-ins:
 drwxrwxrwx  1 Eigenaar Geen 4096 02-05 17:09 doggify

  -rw-rw-rw-  1 Eigenaar Geen 6798 11-09 17:06 gimp_a_generate_bars.py

Since you are in Linux your plugin should read:

Code:
  -rwxrwxrwx  1 Eigenaar Geen 6798 11-09 17:06 gimp_a_generate_bars.py


Ie, it should have the "execute" flag set.

To debug the plugin registration you can put a

Code:
print '****************************************************'

In the plugin code (near the top; anywhere outside a function declaration). Then if you start Gimp in a terminal, this output will be very easy to spot if Gimp sees the script and attempts to register it. Later, the output of any print statement also goes in the Gimp output in a terminal, so it is fairly easy to debug things.

Otherwise there are plenty of reasons why your script doesn't show up and the first one is a syntax error. You can always run your script outside of Gimp in a terminal prompt. If you see:

Code:
   from gimpfu import *
ImportError: No module named gimpfu

then there are no major blunders (unbalanced parens and the like) and python can run the code. Then in the Gimp console find the ************ line and see if there are other errors right under it... You can also check in the pluginrc file , maybe the script isn't registered where you think it is.
Reply


Forum Jump: