Gimp-Forum.net
python-fu: Exiting properly in batche mod with Gimp 2.99 - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: python-fu: Exiting properly in batche mod with Gimp 2.99 (/Thread-python-fu-Exiting-properly-in-batche-mod-with-Gimp-2-99)



python-fu: Exiting properly in batche mod with Gimp 2.99 - mrbookman - 07-23-2021

Greetings.

I should first mention that this problem has to do with the new API.
Due to certain constraints, I have to use python 3, and so I've been using Gimp 2.99.

https://www.gimp-forum.net/Thread-What-is-the-correct-way-to-close-a-python-batch-job

I've tried to adapt the method shown in the thread above for python3, adding a Gimp.quit() at the end of the do_it function.

This is the command I'm using.

Code:
gimp-console-2.99  -idf --batch-interpreter python-fu-eval -b "import sys;sys.path=['.']+sys.path;import backrem;backrem.do_it()"

This is the message I get.


Code:
plug-in 'python-eval.py' aborted before sending its procedure return values
batch command experienced a calling error:
Procedure 'python-fu-eval' returned no return values

Other information:
  1. If I remove 'Gimp.quit()' from the actual script and add '-b "Gimp.quit()"' to the command, I still get an error.
  2. If I remove it from both the script and the command, the process does not terminate.

(I'm aware that this isn't code, but I couldn't find the appropriate BBCode tags)


RE: python-fu: Exiting properly in batche mod with Gimp 2.99 - Ofnuts - 07-24-2021

Tried to put the gimp.quit() after backrem.do_it() ?


RE: python-fu: Exiting properly in batche mod with Gimp 2.99 - mrbookman - 07-24-2021

(07-24-2021, 06:57 AM)Ofnuts Wrote: Tried to put the gimp.quit() after backrem.do_it() ?

Thank you for the reply!

I tried it after you suggested it. It doesn't seem to improve anything. Still the same error.

Additional info: My code is only a script, it's not a plugin per se. I haven't implemented do_query_procedures and do_create_procedure (according to https://wiki.gimp.org/wiki/Hacking:Plugins_v3).


RE: python-fu: Exiting properly in batche mod with Gimp 2.99 - mrbookman - 08-01-2021

I have found a solution. I was stupid to have overlooked it.

Since it was pdb.gimp_quit() for the old version, for this one, it will naturally be

Gimp.get_pdb().run_procedure('gimp-quit', [True]).

However, it seems to cause memory leaks.