Switch to full style
Ask all general Gimp related questions here
Post a reply

Gimp delete layer error from Python (Console)

Wed Feb 01, 2017 6:05 am

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

Re: Gimp delete layer error from Python (Console)

Wed Feb 01, 2017 6:32 am

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)

Re: Gimp delete layer error from Python (Console)

Wed Feb 01, 2017 6:37 am

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
Post a reply