GIMP Chat
http://gimpchat.com/

Gimp delete layer error from Python (Console)
http://gimpchat.com/viewtopic.php?f=8&t=15235
Page 1 of 1

Author:  PKHG [ Wed Feb 01, 2017 6:05 am ]
Post subject:  Gimp delete layer error from Python (Console)

GIMP Version: 2.8.18
Operating System: Windows
GIMP Experience: Intermediate Level

List any ERROR messages you received:
GIMP 2.8.18 Python Console
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
>>> image = gimp.image_list()[0]
>>> L0 = image.layers[0]; L0
<gimp.Layer 'black ;[300, 800]'>
>>> pdb.gimp_item_delete(L0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: execution error
>>>




Hallo,
Where should this error be reported?
GIMP 2.8.18 Python Console
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
>>> image = gimp.image_list()[0]
>>> L0 = image.layers[0]; L0
<gimp.Layer 'black ;[300, 800]'>
>>> pdb.gimp_item_delete(L0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: execution error
>>>

The deprecated gimp_layer_delete give the same sort of error

Greets
Peter

Author:  ofnuts [ Wed Feb 01, 2017 6:32 am ]
Post subject:  Re: Gimp delete layer error from Python (Console)

Read the fine print: "This procedure deletes the specified item. This must not be done if the image containing this item was already deleted or if the item was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a item which has not yet been added to an image."

If you want to get rid of a layer in an image just do: image.remove_layer(layer)

Author:  PKHG [ Wed Feb 01, 2017 6:37 am ]
Post subject:  Re: Gimp delete layer error from Python (Console)

ofnuts wrote:
Read the fine print: "This procedure deletes the specified item. This must not be done if the image containing this item was already deleted or if the item was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a item which has not yet been added to an image."

If you want to get rid of a layer in an image just do: image.remove_layer(layer)


Thanks, works as you suggested. Nice!
Probably I did not read the info in the Browse correctly

Peter

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/