Accessing stdin from a Python based GIMP Plugin.

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

 



Hello all.

Are there any gotchas that one should be aware of when accessing stdin from
a Python based GIMP Plugin?

The reason I ask, is because I am implementing a Plugin which seems to be
working fine - until such time as I insert the following code into it;

    # Code omitted

    # The sys module is imported at the top of the file.

    list_filenames = ""

    for line in sys.stdin :

        list_filenames = list_filenames + ";" + line

    # Code omitted

If I didn't know better, I'd say the line of code in which the for loop
attempts to read from sys.stdin is causing the problem.

When I run the Plugin - with the above code, from the command line, I get
the following error;

    batch command experienced an execution error:
    Error: ( : 1) eval: unbound variable:
python-fu-runPlugin-multiple-fromList

where runPlugin_multiple_fromList is the name of the Python function which
implements my Plugin.

Now, if I comment out the for loop, then the Plugin works!

I am invoking the following command from the command line (within Linux) in
order to run the Plugin.

    find \
    /home/foo/foreground_images/ \
    -maxdepth 1 \
    -name "*.png" \
    | \
    gimp \
    --no-interface \
    --verbose \
    --console-messages \
    --batch-interpreter="plug-in-script-fu-eval" \
    --batch \
    '( \
    python-fu-runPlugin-multiple-fromList \
    RUN-NONINTERACTIVE \
    "/home/foo/background_images/bg_image.png" \
    "0" \
    "" \
    "/home/foo/images_output/" \
    "0" \
    "result" \
    "0" \
    )' \
    --batch "(gimp-quit 0)"

I'm actually running the command on one line. I have only broken it up
across multiple lines above, to assist with readability.

What I'd ideally like this Plugin to do, is operate on all of the files
which are passed to it via stdin. The find utility is only used above to
help demonstrate the concept. In reality, I will be using another
customised utility which will write the list the files of interest out to
stdout.

Thanks in advance for any assistance.


- Craig
_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux