It is currently Thu Jul 04, 2024 4:46 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Gimp delete layer error from Python (Console)
PostPosted: Wed Feb 01, 2017 6:05 am  (#1) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
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


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Gimp delete layer error from Python (Console)
PostPosted: Wed Feb 01, 2017 6:32 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
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)

_________________
Image


Top
 Post subject: Re: Gimp delete layer error from Python (Console)
PostPosted: Wed Feb 01, 2017 6:37 am  (#3) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
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


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Load As Layers Wire Initialization Error With Python

6

No new posts Curve Bend tool called from python giving error not very consistent.

0

No new posts Attachment(s) Python occasional "Unexpected error: [Errno 9] Bad file descriptor"

3

No new posts Attachment(s) manipulate a portion of text inside a text layer using python-fu

2

No new posts GIMP 2.10 console etc Macbook

0



* Login  



Powered by phpBB3 © phpBB Group