Hi,
I am running simple script to get tag name but it ending up with an error:
"Error_ExpressionEval("Error executing script for runScript() expression:default.ReadIniFile.myFunc()")
Tag is connected to the PLC using OPC connection.
script:
def myFunc(text="Hello World!", moreText="Good bye"):
str(text)
return text
What is the line str(text)
supposed to do? There is no assignment operator.
Tip: format your code when posting on the forum.
Your expression is runScript("default.ReadIniFile.myFunc()")
but the path in your screengrab suggests that it should be runScript("generate.ReadIniFile.myFunc()").
That is correct, if it is blank then there is no Gateway Scripting Project configured.
Scripts that run outside of a project scope (tag scripts, etc...) are not projects and therefore need to be told where to look for the script.
I believe that you can set the Gateway Scripting Project to the name of your project and it should work. If you are only ever going to have the one project this is probably fine, but if you intend to have more than one project, this should probably be a stand alone project.
Often this project is used as the root project and set to inheritable, then all other project inherit from it. That way things inside of the project will also have access to the script.