GatewayException: Error serializing parameters

Greetings…

I am having an issue writing a value to an memory tag via script. The error generated is:
GatewayException: Error serializing parameters.
caused by NotSerializableException: org.python.core.ReflectedArgs
Ignition v7.9.3 (b2017060210)
Java: Oracle Corporation 1.8.0_131

The memory tag is configured as Type: Integer and Read/Write. It will write to the tag if using binding, but chokes on script. The component I am firing this from is a One-Shot button on the actionPerformed handler, and the value being written is the property: Set Value (in this case, the integer 180)

The script causing the error:

OSvalue = event.source.setValue
if event.source.parent.parent.parent.getComponent('ExecuteGroup').getComponent('Toggle Button 1').componentEnabled:
   system.tag.write("ASRS/CraneMove/CraneDestPos_Abs", OSvalue)
else:
   system.tag.write("ASRS/CraneMove/CraneStartPos_Abs", OSvalue)

Documentation says that the ‘value’ argument for system.tag.write is of type Int, so I’m a little confused why this will not write to the tag. The path to component and tag were generated using the browse method, so they are correct. I would appreciate any assistance. I hope it is common problem with an easy fix.

Kind regards,
Steve

Have you printed/checked the value of OSValue?

This line:
OSvalue = event.source.setValue

looks suspect to me.

Yeah, so the one-shot button actually has a method on it named setValue which is what you’re getting when you try to reference the property.

Try this instead: OSValue = event.source.getSetValue()

Just an unfortunate naming clash here.

Kevin, thank you! That worked great. Is the ‘getxx()’ nomenclature the normal syntax for revealing values?

I have to say though, that is less than user friendly - especially when using the ‘browse’ icon to drill down to the Set Value property - one would think a variable would be set to the value within the method and not the Method descriptor.

Cheers,
Steve

Everything is getXxYy() and setXxYy() “under the hood” but are also given the Python-friendly property accessors that you’re accustomed to using.

Like I said, this is an unfortunate naming clash where the property called ‘Set Value’ or ‘setValue’ clashes with a method name on the button.

Thank you. Good info. I could find no info in the manual regarding this syntax. Your results may vary.