Re: [Gimp-developer] Problems using the PF_STRINGARRAY parameter type when writing a Python plugin for Gimp.

If you want to run the script as a batch it doesn't need (and really shouldn't be) a plugin. Then your code is just a plain Python function that takes string parameters, and you don't need to register it. See

On 05/23/18 02:17, Craig Sanders wrote:

I'm trying to write a very basic plugin for Gimp using Python and I
want its one and only parameter to be of type PF_STRINGARRAY. The goal
of my plugin for the time being, is to receive a list of files, and
then simply print their names on the Command line, when the plugin is

The code for my plugin is as follows;

from gimpfu import register, main, pdb, PF_STRINGARRAY

def \

) :

        for filename in listOfFiles :

                print("Filename = %s" % filename)

        "process-list-of-files",                # The name of the command
        "Process a list of files",              # A brief description of the command
        "Process a list of files",              # Help message
        "John Doe",                             # Author
        "John Doe",                             # Copyright holder
        "2018",                                 # Date
        "<Image>/Image/Process list of files",  # The way the script will be
referred to in the menu
        "RGB*, GRAY*",                          # Image mode
                (PF_STRINGARRAY, "listOfFiles", "List of files", [""])


<<<<< END CODE SEGMENT <<<<<

I then run this plugin from the Command line using the following command;

gimp --no-interface --verbose --console-messages
--batch-interpreter='plug-in-script-fu-eval' --batch
'(python-fu-process-list-of-files RUN-NONINTERACTIVE
["/home/john/test.txt"])' --batch "(gimp-quit 1)"

Unfortunately, it doesn't work for me and complains with the messages;

Starting extension: 'extension-script-fu'
batch command experienced an execution error

If I now change my plugin's parameter type to be PF_STRING, and update
my code and Command line invocation method accordingly, it works! I
know that I could get around this problem by passing filenames in as
one string, where the filenames are separated by the ":" character,
but I want the code in the plugin to be as simple as possible.

So I guess my question is; is the PF_STRINGARRAY type supported, or am
I doing something wrong? I am using Gimp version 2.6.9.

Any help would be immensely appreciated.

Thanks in advance.
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
List archives:

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