Script issue at one plant, others run fine

I have a script to pull my devices information out of Ignition and display the results in a perspective table. I have 20 plants using this same script and it is an imported project used everytime I build another plant. However a single plant errors out the code for one line that is highlighted in the pic below for ipaddress. The error is also in the snip. I also thought I was missing a module but it matches to the other plants.

Perhaps you should employ some exception handling at this location, in case there is a device in your list that does not have a hostname property.

Example:

		try:
			ipaddress = system.device.getDeviceHostname(device_ds.getValueAt(x,0))
		except:
			pass

You might have a Simulator Running or maybe a driver that is not compatible with system.device.getDeviceHostname. Just skip like @justinedwards.jle said.

try:
   ipaddress = system.device.getDeviceHostname(device_ds.getValueAt(x,0))
except:
   ipaddress=None
1 Like

@jespinmartin1
Nice approach; passing a null value does make more sense than completely abandoning the iteration.

I don't even get to apply it, goes right into compiler fault. Same modules, devices and drivers as other plants.

Share data from "device_ds" to give it a look.

What is the state of the Ignition OPC-UA loopback?

In the meantime, reset the opc module if you consider is save to. WARN, keep in mind all you device connection will get lost for some seconds.

That makes it sound like the compiler is rejecting the code for something like a syntax error. Looking at your picture, all the colons are there, and all the parenthesis [' and ()] look correct. I can't make out any squiggly red lines, but I do notice that the comment spacing under line 15 looks off, and I have had that sort of thing affect my compiles before, but it's hard to say. Try highlighting your code and using shift+tab to move everything all the way to the left. Then, redo all of the tab spacings, so that you know for sure that a copy and paste function hasn't messed your indentions up.

Beyond that, I'm out of ideas. The getDeviceHostname method was in place before version 7.9, so I can't imagine that this is a version issue.

Edit: I had used the word parenthesis, but I was really referring to these: (), I have seen the apostrophes cause a problem too when copied and pasted, but if I remember correctly, that yields a specific Unicode character fault.

Here you're looking for a mixture of tabs and spaces for code indentation. You can only use one in a code block

1 Like

I tried all those things based on my same past experiences. I didn't copy and paste, I imported the project which works everywhere else.

1 Like

Sounds like time to open a support ticket and let support poke around.

2 Likes

Can you show the full error ?

1 Like

No the output console won't show the error. What I sent is all I get.

You should have the full trace in your logs.
edit: assuming that script transform actually ran. If it didn't, then clearly there won't be anything in the logs.

Logs show nothing even when I did it on purpose to create an issue so I could see it.

This is the best I can do to get the entire error message.

Looks like @jespinmartin1 was right, you seem to have a simulator running.

2 Likes

Ran through image to text converter to make it easier to read:
#1. data: null found, array, dataset expected #2. Data quality. Error_ScriptEval("Traceback (most recent call last): File "", line 15, in transform at com.inductiveautomation.ignition.gateway.opcua scripting.IALabsGatewayScriptingFunctions.getDevice Hostname(IALabsGatewayScriptingFunctions.java:609) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.Exception: java.lang.Exception: Hostname not found for device 'Simulator' ")

Yup. Simulators don't have a hostname.

Yes this was the first plant the integrator did and I am in the process of removing it after verifying it is not being used it in the background somewhere. Once done I will post the result.
I also found other discrepancies in the install of Ignition that I tried first, and needed to be done anyway.

This change works, thanks.

1 Like