[Python] Python-fu script not showing in Gimp menu

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I’ve been at Gimp: python script not showing in menu and it didn’t help me. Here’s what I tried, step by step:

    1. I’m running Gimp 2.8.16 on Mac OS X 10.9.5 from the command line with gimp as my .bashrc file includes

    alias gimp='/Applications/GIMP.app/Contents/MacOS/GIMP --verbose --console-messages '


    I look at the terminal output, I see lots of messages but nothing pops out as a problem (do you want the dump here?). I see right at the start Enabling internal Python... so that should be good.

    2. Filters > Python-Fu > Console brings up the console, with

    GIMP 2.8.16 Python Console
    Python 2.7.8 (default, Dec 5 2015, 09:38:54)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
    >>>


    —so, once again, python seems to be working.

    3. Because of this tip here I tried running a Python script. I opened an image and ran Filters > Render > Clouds > Fog. Works like a charm – in the console I do get a few type conversion warnings when the window is fired up:

    ** (foggify.py:30312): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
    ** (foggify.py:30312): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
    ** (foggify.py:30312): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'


    I searched my computer and foggify.py is actually in /Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/plug-ins/foggify.py so this proves that Python is working, but not that it’s loading scripts. I’m a little confused as foggify.py only has 77 lines, not 30312.

    4. GIMP > Preferences > Folders > Scripts shows GIMP should load the following directories for scripts:

    /Users/julio/Library/Application Support/GIMP/2.8/scripts
    /Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts


    I’m not using /Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts but it has a lot of *.scm files (so, probably all in Scheme). I never added anything here myself.

    5. I only have a single script: ls -l "/Users/julio/Library/Application Support/Gimp/2.8/scripts" yields

    total 8
    -rwxr-xr-x 1 julio staff 654 25 Jun 16:25 minimal.py


    (nothing else)

    6. Here’s my minimal.py:

    #!/usr/bin/env python

    from gimpfu import *

    def minimal():
    pass

    register(
    "python_fu_minimal", # plugin name
    "Minimal plug-in example", # blurb (short description)
    "Show the smallest possible Python plug-in example", # help (long description)
    "Michael Schumacher", # author
    "Michael Schumacher", # copyright info
    "2007", # date
    "<Image>/Tools/Minimal", # menu position and label
    None, # image types accepted
    [], # input parameters
    [], # output (results)
    minimal # method to call
    )

    main()


    7. I run gimp with minimal.py already in the scripts directory indicated above, and I can’t see any “Minimal” item in the “Tools” menu.

    I also tried the variation below, which didn’t work either:

    #!/usr/bin/env python

    from gimpfu import *

    def minimal():
    pass

    register(
    "python_fu_minimal", # plugin name
    "Minimal plug-in example", # blurb (short description)
    "Show the smallest possible Python plug-in example", # help (long description)
    "Michael Schumacher", # author
    "Michael Schumacher", # copyright info
    "2007", # date
    "Minimal", # menu position and label
    None, # image types accepted
    [], # input parameters
    [], # output (results)
    minimal, # method to call
    menu="<Image>/Tools"
    )

    main()

    Continue reading...

Compartilhe esta Página