Error writing to tag Bad_Unsupported

I’m writing a script to iterate through an array and write the tags to an array in a Rockwell PLC using the OPC server.

The tag values do write (most of the time, some don’t write the first pass but will the second) but for every write I get

“11:17:31.354 [Thread-16572] ERROR com.inductiveautomation.ignition.client.script.LegacyClientTagUtilities - Error writing to tag ‘[default]PEM Tags/PEM_Data/PEM_Data_103_/PEM_Type.value’: Bad_Unsupported”


import csv

with open('C:\\Users\image\Desktop\pems csv1.csv') as csvfile:
    readCSV = csv.reader(csvfile, delimiter=',')
    names = []
    x = []
    y = []
    z = []
    i = 0
    nameTag1 = "[default]PEM Tags/PEM_Data/PEM_Data_0_/PEM_Type.value"
    xTag1 = "[default]PEM Tags/PEM_Data/PEM_Data_0_/X_Location"
    yTag1 = "[default]PEM Tags/PEM_Data/PEM_Data_0_/Y_Location"
    zTag1 = "[default]PEM Tags/PEM_Data/PEM_Data_0_/Z_Location"
    for row in readCSV:
    	if i > 3:
        	if (i % 2) == 0:
        		name = row[0]
        		#system.tag.write(nameTag1.replace("0", str(i - 4)),name)
        	if (i % 2) == 1:
        		x1 = row[2]
        		y1 = row[3]
        		z1 = row[4]
        		#system.tag.write(xTag1.replace("0", str(i - 4)),x1)
        		#system.tag.write(yTag1.replace("0", str(i - 4)),y1)
        		#system.tag.write(zTag1.replace("0", str(i - 4)),z1)
        i = i + 1
    for j in range(len(names)):
    	system.tag.write(nameTag1.replace("0", str(j)),names[j])
    	system.tag.write(xTag1.replace("0", str(j)),x[j])
    	system.tag.write(yTag1.replace("0", str(j)),y[j])
    	system.tag.write(zTag1.replace("0", str(j)),z[j])

Why do you have “.value” in the tag path?

I’ve used that before and it worked, is it not needed?

If you read a tag using you will receive a fully qualified tag object that has a property named value that can be referenced using “.value”.

When writing a value to a tag you must provide a path. The path will be a string and strings do not have a value property.

Reading and Writing to Tags