scripting problems
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
scripting problems | Al Niessner | 18 Feb 20:05 |
scripting problems | Sven Neumann | 18 Feb 21:02 |
scripting problems | Sven Neumann | 18 Feb 21:22 |
scripting problems | Sven Neumann | 18 Feb 21:26 |
scripting problems | Al Niessner | 18 Feb 21:55 |
scripting problems | Sven Neumann | 18 Feb 22:19 |
scripting problems | Al Niessner | 18 Feb 22:27 |
scripting problems | Sven Neumann | 18 Feb 22:49 |
scripting problems | Manish Singh | 19 Feb 11:33 |
scripting problems
I have found posts related to this error in the forum, but nothing really matches. I have also googled for a solution and found none.
The difficulty that I am having starts with this really simple python script in a file called gimpTest.py:
from gimpfu import *
print "I am running the script"
gimp.quit()
It really does not get much simpler and yes there is a new line after gimp.quit(). I then invoke it using:
gimp --no-interface --console-messages --no-data --no-splash --batch-interpreter python-fu-eval --batch - < gimpTest.py
I expect the the line "I am running the script" to print and then GIMP to exit -- see http://www.gimp.org/docs/python/index.html for details on gimp.quit(). Well, if that is what happens, then I would not be posting this email. Here is what happens:
niessner@charon:~$ gimp --no-interface --console-messages --no-data
--no-splash --batch-interpreter python-fu-eval --batch - < gimpTest.py
I am running the script
batch command: experienced an execution error.
gimp: terminated: Interrupt /usr/lib/gimp/2.0/plug-ins/script-fu terminated: Interrupt
Now, many of the other posts had other scripting errors that caused GIMP to display the "batch command: experienced an execution error." message, but I cannot find any problems in my 3 liner.
While I am a complete newbie with scripting GIMP, I still cannot find anything in the documentation or GIMP man page that would indicate that my experience is the normal behavior. So, would someone please let me know what silly thing I am doing wrong so that gimp.quit() will cause GIMP to exit like the documentation says it should?
I should note that it is way too interesting that he script-fu is being terminated with the ctrl-C rather than python-fu since the command line specifies this interpreter. However, that is GIMPness way beyond my level at this point.
scripting problems
Hi,
On Mon, 2008-02-18 at 11:05 -0800, Al Niessner wrote:
I have found posts related to this error in the forum, but nothing really matches. I have also googled for a solution and found none.
The difficulty that I am having starts with this really simple python script in a file called gimpTest.py:
from gimpfu import * print "I am running the script"
gimp.quit()It really does not get much simpler and yes there is a new line after gimp.quit(). I then invoke it using:
gimp --no-interface --console-messages --no-data --no-splash --batch-interpreter python-fu-eval --batch - < gimpTest.py
I don't think using "--batch -" works with python-fu-eval. It might make sense to add this as a special case just like it is being done for script-fu-eval now.
Sven
scripting problems
Hi,
On Mon, 2008-02-18 at 21:02 +0100, Sven Neumann wrote:
I don't think using "--batch -" works with python-fu-eval. It might make sense to add this as a special case just like it is being done for script-fu-eval now.
Please ignore what I said. python-fu-eval does special-case the "-" command already.
Sven
scripting problems
Hi,
On Mon, 2008-02-18 at 11:05 -0800, Al Niessner wrote:
I expect the the line "I am running the script" to print and then GIMP to exit -- see http://www.gimp.org/docs/python/index.html for details on gimp.quit().
The documentation you are looking at is hopelessly outdated. gimp.quit() exits the plug-in (python-fu-eval in this case), not the GIMP application.
http://developer.gimp.org/api/2.0/libgimp/libgimp-gimp.html#gimp-quit
It would be very nice if someone could eventually volunteer to update the GIMP-Python documentation. It's a shame that we now have a nice scripting language but no one can use it because it is almost completely undocumented...
Sven
scripting problems
Sorry about getting twice Sven, but I should keep it on the list for the next person searching the archives.
Any suggestions or guesses on how to make the GIMP application exit?
On Mon, 2008-02-18 at 21:26 +0100, Sven Neumann wrote:
Hi,
On Mon, 2008-02-18 at 11:05 -0800, Al Niessner wrote:
I expect the the line "I am running the script" to print and then GIMP to exit -- see http://www.gimp.org/docs/python/index.html for details on gimp.quit().
The documentation you are looking at is hopelessly outdated. gimp.quit() exits the plug-in (python-fu-eval in this case), not the GIMP application.
http://developer.gimp.org/api/2.0/libgimp/libgimp-gimp.html#gimp-quit
It would be very nice if someone could eventually volunteer to update the GIMP-Python documentation. It's a shame that we now have a nice scripting language but no one can use it because it is almost completely undocumented...
Sven
scripting problems
Hi,
On Mon, 2008-02-18 at 21:26 +0100, Sven Neumann wrote:
I expect the the line "I am running the script" to print and then GIMP to exit -- see http://www.gimp.org/docs/python/index.html for details on gimp.quit().
The documentation you are looking at is hopelessly outdated. gimp.quit() exits the plug-in (python-fu-eval in this case), not the GIMP application.
So in order to fix your script you will have to use
from gimpfu import *
print "I am running the script"
pdb.gimp_quit(0)
Perhaps it would make sense for the Python binding to map this procedure to a method on the gimp object. Perhaps gimp.exit() ?
Sven
scripting problems
Dang! I tried pdb.gimp-quit() like in script-fu and it, of course, did not work. I then browsed http://developer.gimp.org/api/2.0/index.html looking for a quit or some type of control over gimp and did not see anything.
It works. Thanks.
Personally, pdb.gimp_quit(0) makes just as much sense as gimp.exit() as long as it noted somewhere.
On Mon, 2008-02-18 at 22:19 +0100, Sven Neumann wrote:
Hi,
On Mon, 2008-02-18 at 21:26 +0100, Sven Neumann wrote:
I expect the the line "I am running the script" to print and then GIMP to exit -- see http://www.gimp.org/docs/python/index.html for details on gimp.quit().
The documentation you are looking at is hopelessly outdated. gimp.quit() exits the plug-in (python-fu-eval in this case), not the GIMP application.
So in order to fix your script you will have to use
from gimpfu import * print "I am running the script"
pdb.gimp_quit(0)Perhaps it would make sense for the Python binding to map this procedure to a method on the gimp object. Perhaps gimp.exit() ?
Sven
scripting problems
On Mon, 2008-02-18 at 13:27 -0800, Al Niessner wrote:
Personally, pdb.gimp_quit(0) makes just as much sense as gimp.exit() as long as it noted somewhere.
All PDB procedures are documented in the Procedure Browser that you can reach from the Xtns menu in the toolbox.
Sven
scripting problems
On Mon, Feb 18, 2008 at 01:27:36PM -0800, Al Niessner wrote:
Dang! I tried pdb.gimp-quit() like in script-fu and it, of course, did not work. I then browsed http://developer.gimp.org/api/2.0/index.html looking for a quit or some type of control over gimp and did not see anything.
Not sure why you expected pdb.gimp-quit() to work, "-" isn't a valid character in symbol names in python. That gets parsed as:
pdb.gimp - quit()
Or "subtract the result of calling the function 'quit' from the value of 'pdb.gimp'"
As Sven said, pdb.gimp_quit(0) works, as well as pdb["gimp-quit"](0)
Personally, pdb.gimp_quit(0) makes just as much sense as gimp.exit() as long as it noted somewhere.
I've just added gimp.exit() to SVN. It takes an optional boolean for force, and defaults to False.
-Yosh