Runscript() not working after upgrading from 7.9 to 8

As per the above. I have a series of expression tags that run shared scripts to return values. These worked fine before the upgrade to 8, but won’t work at all. I even created a new expression tag and script using this example from the help, and again can’t get it to work:

https://docs.inductiveautomation.com/display/DOC80/runScript

I’m sure it’s something obvious, but at the moment i’m stuck!

What script are you trying to run?

Hi Kevin,

Thanks for the quick reply. None of my old shared scripts are working at the moment with runscript in an expression tag. To simplify, I followed the example in the (runscript) help. This doesn’t work either. I’m guessing it’s to do with the new inherited project architecture and probably me placing the script in the wrong place or something like that…

Is the “Gateway Scripting Project” set to “global” or whatever the name of your parent project is under Config > System > Gateway Settings on the gateway?

3 Likes

Yes, and the “global” project is where the shared scripts were moved to on upgrade:

It looks like you’re trying to create and reference the “Test” package in a child project, though, which won’t work.

Can I copy / move the scripts into the project I want to run them from? They don’t have to be “Global” as I only need to call them from one project. I’m just a little confused as they worked immediately before the upgrade and nothing was changed configuration - wise after upgrade.

Tags don’t belong to a project, copying them isn’t going to do anything in this case. Any tag change script or expression runScript can only reference scripts defined in whatever the Gateway Scripting Project is.

I’m not sure it’s the same problem you’re seeing, but I am seeing some weird behavior where an expression tag with a runScript expression in it shows eval error on a fresh gateway start until I right-click -> Restart Tag.

So I re-ran the ignition 8 installer and all seems to be well now. I guess something must’ve broken the first time round. Thanks for your help.

A post was split to a new topic: runScript on client tag stops working

@Kevin.Herron, I think I encounter a similar issue:
Ignition 8.0.5
Gateway Scripting Project set to “global”
I’ve create a new tag expression with a runscript.

runscript("shared.tag.alarm.test",0)

in the global project:

def shared.tag.alarm.test()
  import shared.tag.util
  return 0

Expression return :

[null, Error_ExpressionEval("Error executing script for runScript() expression:shared.tag.alarm.test"), Thu Oct 17 17:04:44 CEST 2019 (1571324684504)]

if I supprim the import, tag expression is OK:

def shared.tag.alarm.test()
  return 0

The same expression with the import inside the shared.tag.alarm.test, works with no issue in 7.9

Thanks! I had an alarm label runScript that worked on one gateway but not the other and I was trying to figure out where that final difference was, and Gateway Scripting Project was exactly what I needed to find!

This is an important config but not documented anywhere.

Sure it is.

2 Likes

Which is why, if you do an upgrade in place, or restore a gateway backup from 7.9 into 8.x, the upgrade process sets this configuration up properly for you.

1 Like