Passing objects to a project script does not work. It must be passed as a string

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 ?

I have never had an issue passing an Object to a library script.

How does a recursion depth error indicate that passing the object didn't work?

I would say you have a different issue in your Library script.

Can you share the library script?

2 Likes

I cannot replicate the issue on myside any more. You are right, the real issue was indeed something else. Sorry for not re verifying my understanding before posting an issue.

The library script has been heavily refactored since last week, when I was experiencing this issue. I am now passing the string parameters. After reading your reply, I changed it a bit use objects and it did work. So it must have been something else which did not caught my eye even after spending quite some time struggling with it last week.

I will close this issue now. Thanks for your proactiveness.