开云体育

Locked Re: Deleting Objects in Scripts


 

开云体育

The PropertyVetoException tells you that the sensor is in use in block IB10.

You should remove the sensor from the block where it is used, before removing the sensor.

When sensors.deleteBeans(s,"CanDelete") does _not_ throw an exception, you can go ahead and delete the sensor with:

sensors.deleteBeans(s,"DoDelete")

Daniel

On 2024-09-18 22:00, Snorkel wrote:

Using sensors as an example I learned that I could delete a sensor with
?
sensors.deleteBean(s,"DoDelete")
?
However I saw that it would be better to check for listeners before doing this and that
?
sensors.deleteBeans(s,"CanDelete")
?
might do the job. However I get a bunch of errors starting with
?
javax.script.ScriptException: java.beans.PropertyVetoException: java.beans.PropertyVetoException: Found in the following <b>Blocks</b><ul><li>IB10</li></ul>It will be removed from the Blocks<hr> in <script> at line number 4
?
It seems like I should be able to handle the exception but I don't know how.

Join [email protected] to automatically receive all group messages.