RESOLVED: Execute DAT 'Expected locked operator'

Brought a tox into a project which worked fine before, and now it gives me:

td.tdError: Expected locked operator, or execution within onCook method of a Script Operator.

The offending line is:


script1 definitely exists and is a sibling of my Execute DAT.

Anyone seen this? Google doesn’t turn anything up for that error message.

Hey @charliewilliams

Thanks for the report.

Difficult to tell without a sample file here.

Can you please share a simple .tox with the issue? Is it in the stable build or new experimental?


What happened here was that older builds were modifying DAT contents somewhat unreliably.

The clear() and other methods should only be called within the scripts onCook() operator, otherwise
the script may overwrite it when it eventually executes onCook().

In this case, add the line:

op(‘script1’).lock = True

before attempting to clear it.
This will lock the operator though.

If you really do need the Script DAT to manage its contents, then the clear() call should be there, not in the Execute DAT.


Also happen with script Chop when using clear or trying to change numSamples when executing onPulse

See for yourself :slight_smile:

@rob interesting that this change was implemented. It unfortunately breaks a lot of things for me but also the fix is not really complicated, just need to go through and make sure the script chop or sop is locked.

If someone is not using the script chop/dat callback at all (disabled, removed), and is writing to that node as a sort of data buffer from else where, is there still some kind of unreliability factor?

It wouldn’t necessarily be unreliable, but there would be nothing stopping the script from updating itself again with new callbacks.
Locking it guarantees it will only be modified outside the onCook callbacks.

1 Like