简体   繁体   中英

Gimp Python script not showing in menu

I am trying to write a python-fu script to simply print a warning to the error console. I have this same thing working fine with schema-fu.

But its not showing on the menu with python-fu.

I have the script in the directory configured within gimp for the plugins: /Users/myusername/Library/Application Support/GIMP/2.10/plug-ins

the file is named: python-fu-hello-warning.py

Running this in MacOS Catalina, version 10.15.3. The version of GIMP is 2.10.14.

This is the code:

#!/usr/bin/env python

# Hello Warning 

from gimpfu import *

def hello_warning():
     pdb.gimp_message("hello warning")

register(
    "python_fu_hello_warning",
    "Hello warning",
    "Hello warning TO ERROR CONSOLE",
    "Walter Moore",
    "Walter Moore",
    "2020",
    "Hello warning (Py)...",
    "",
    [],
    [],
    hello_warning, 
    menu="<Image>/File/HelloWarning"
)

main()

What am i doing wrong?

Works for me, so the only reasons I can think of is that either:

  • the file isn't in one of the directories scanned by Gimp (Edit>Preferences>Folders>Plugins)
  • you didn't set the file as executable ( chmod +x ... ). On OSX and Linux, Gimp only scans for files marked as executable in the plugins directories.

In the general case if your plugin doesn't register:

  1. Before even adding it to Gimp, do a python pluginfile.py in a terminal, blatant errors will show there. When it complains about gimpfu you are good to go.
  2. Add some visible marker lines print '*************************' at the top of your main, this will be executed each time the plugin runs and make it easier to spot other output from your script. You can also use more informative print lines.
  3. Start Gimp in a terminal. If you don't see the marker line then your code is likely not run at all: is it a directory scanned by Gimp? Is is executable?
  4. Look for runtime error messages and fix them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM