Passing objects to a project script does not work. It must be passed as a string.
In the Gateway Tag Change Scripts, I wanted to write this
tag_path = str(event.tagPath)
tag_values = system.tag.readBlocking(tag_path)[0]
MyProjectScriptInLibrary.execute(event, tag_values)
However, this does not work and I get a maximum recurion depth exceeded error.
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 209, in RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
With further trial and error I realized that passing strings works fine but passing objects does not. Therefore, I modified my script and wrote the below script. This works fine.
prev_val = str(event.previousValue)
curr_val = str(event.currentValue)
tag_path = str(event.tagPath)
if prev_val != curr_val:
tag_value_list = system.tag.readBlocking(tag_path)
MyProjectScriptInLibrary.execute(tag_path,
{"tag_value": tag_value_list[0].value, "tag_quality": str(tag_value_list[0].value), "tag_timestamp": system.date.format(tag_value_list[0].timestamp,"YYYY-MM-dd'T'HH:mm:ss.SSS'Z'")},
{"event_current_value": str(event.currentValue), "event_previous_value": str(event.previousValue)}
)
My question is, why is passing of objects not supported in such a case ?