Unexpected writing to memory array tags

I have a script where I read the value of a memory array tag. I then manipulate the data in my script. I am finding that the value of the tag is being modified by the script even without using system.tag.write()

I’m using 7.9.9

I have made a really simple script that has this behavior so hopefully you can see what I am talking about. In this case, “inttest” is a memory integer array tag.

test = system.tag.read("inttest").value

test[3] = 7

after running this script. the value of the tag inttest[3] will be 7 even though I never wrote back to the tag. Is this intended behavior?

This behavior is similar to lists in python. where you will need to use copy() to create a new instance of the list to avoid modifying the original. However I can’t seem to do this. If I try to run new_array = copy(test) on the above script, I get the following error: TypeError: ‘module’ object is not callable.

Hopefully this is clear enough.


Yikes. This shouldn’t work. Thanks for the report :slight_smile:

is there something that I can do to avoid it happening? my array in my actual script is 231 elements long and this is causing the tag to update 231 times instead of once at the end of the script. Its not the end of the world but I imagine its adding extra strain on the system.

You’d have to make a copy of the array value before modifying it.