# Script issue at one plant, others run fine

**URL:** <https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 1, 2022, 3:07am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727 "2022-10-01T03:07:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 1, 2022, 3:07am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/1 "2022-10-01T03:07:54Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/a/0a02e5303c9e708bcfebab9a2c5c1a6cc69ced72.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 1, 2022, 4:20am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/2 "2022-10-01T04:20:20Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [October 1, 2022, 5:02am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/3 "2022-10-01T05:02:08Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 1, 2022, 5:06am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/4 "2022-10-01T05:06:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 1, 2022, 5:10am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/5 "2022-10-01T05:10:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [October 1, 2022, 5:17am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/6 "2022-10-01T05:17:05Z")

</div>

Share data from "device\_ds" to give it a look.

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/d/fd526eecabce9f392bbc550d1e1c31e0a5a9c172.png)

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.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 1, 2022, 5:43am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/7 "2022-10-01T05:43:47Z")

</div>

> [@CTrenkamp](#):
>
> I don't even get to apply it, goes right into fault

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.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 1, 2022, 12:31pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/8 "2022-10-01T12:31:53Z")

</div>

> [@justinedwards.jle](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 1, 2022, 1:41pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/9 "2022-10-01T13:41:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 1, 2022, 2:01pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/10 "2022-10-01T14:01:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 3, 2022, 11:21am UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/11 "2022-10-03T11:21:10Z")

</div>

Can you show the full error ?

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 3, 2022, 12:40pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/12 "2022-10-03T12:40:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 3, 2022, 12:43pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/13 "2022-10-03T12:43:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 3, 2022, 12:51pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/14 "2022-10-03T12:51:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 3, 2022, 12:53pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/15 "2022-10-03T12:53:52Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/6/16210aa60d74d7462e785d83edb8d2468c40160a.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 3, 2022, 1:01pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/16 "2022-10-03T13:01:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 3, 2022, 1:04pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/17 "2022-10-03T13:04:35Z")

</div>

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' ")`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 3, 2022, 1:08pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/18 "2022-10-03T13:08:09Z")

</div>

> [@pascal.fragnoud](#):
>
> have a simulator running.

Yup. Simulators don't have a hostname.

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 3, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/19 "2022-10-03T13:54:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [October 3, 2022, 2:02pm UTC](https://forum.inductiveautomation.com/t/script-issue-at-one-plant-others-run-fine/64727/20 "2022-10-03T14:02:09Z")

</div>

> [@justinedwards.jle](#):
>
> ```auto
> try:
> ipaddress = system.device.getDeviceHostname(device_ds.getValueAt(x,0))
> except:
> pass
> 
> ```

This change works, thanks.
