# Scripting Console Error

**URL:** <https://forum.inductiveautomation.com/t/scripting-console-error/45819>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [April 20, 2021, 4:44pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819 "2021-04-20T16:44:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 4:44pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/1 "2021-04-20T16:44:52Z")

</div>

I have seen some other posts for this issue and the most recent one was not resolved. I went through and uninstalled, cleared cache, reinstalled Jython, and I am at a loss.

```auto

Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) 
[OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java11.0.9

>>> ImportError: Cannot import site module and its dependencies: Error loading module DevceList: Traceback (most recent call last):
  File "<module:DevceList>", line 1, in <module>
NameError: name 'system' is not defined

Determine if the following attributes are correct:
  * sys.path: [C:\Users\rdlab\.ignition\cache\gw10.10.5.10_80\C0\pylib, C:\Users\rdlab\.ignition\cache\resources\platform\jython-2.7.1-ia5.jar\000000001498F8CC\Lib, __classpath__ , __pyclasspath__ /]
    This attribute might be including the wrong directories, such as from CPython
  * sys.prefix: C:\Users\rdlab\.ignition\cache\resources\platform\jython-2.7.1-ia5.jar\000000001498F8CC
    This attribute is set by the system property python.home, although it can
    be often automatically determined by the location of the Jython jar file

You can use the -S option or python.import.site=false to not import the site module

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 20, 2021, 4:55pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/2 "2021-04-20T16:55:23Z")

</div>

What do your project scripts look like? Do you have one named `system` or any other reserved name? Is it possible there’s a line in any of your scripts that’s reassigning `system` to something else? As in, `system = xyz`, inadvertently.

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 4:58pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/3 "2021-04-20T16:58:11Z")

</div>

[https://docs.inductiveautomation.com/display/DOC81/system.device.listDevices](https://docs.inductiveautomation.com/display/DOC81/system.device.listDevices)

was playing around with this and the only place it says system is in the system.device.listDevices

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 20, 2021, 5:02pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/4 "2021-04-20T17:02:11Z")

</div>

Do you have a script called DeviceList?

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 5:02pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/5 "2021-04-20T17:02:34Z")

</div>

yeah I do.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 20, 2021, 5:03pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/6 "2021-04-20T17:03:17Z")

</div>

Sorry, I hit reply before finishing…

EDIT: What are the contents of the script?

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 5:11pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/7 "2021-04-20T17:11:58Z")

</div>

I was trying to play with your script actually from here: [system.device.listDevices() - specifying server? - #5 by JordanCClark](http://forum.inductiveautomation.com/t/system-device-listdevices-specifying-server/16721/5)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 20, 2021, 5:13pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/8 "2021-04-20T17:13:57Z")

</div>

You have good taste. lol

Can you give a screen shot of where the script is located?

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 5:15pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/9 "2021-04-20T17:15:14Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/827336fdaac5fe9e00f2f3ef2d96f0df843375cc.png) I was just trying it out in the console, it does send a single value to my dataset.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 20, 2021, 5:17pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/10 "2021-04-20T17:17:40Z")

</div>

The error is implicating a _project script library_ called `DevceList` [sic] - what you’re doing in the script console is unrelated to what’s actually causing the error.

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 5:22pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/11 "2021-04-20T17:22:16Z")

</div>

Yup look at that, just needed to nuke some scripts and all fixed.

---

<div class="post-metadata">

**Author:** ![Dillon.lee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon.lee/32/23967_2.png) [@Dillon.lee](https://forum.inductiveautomation.com/u/Dillon.lee)\
**Post date:** [April 20, 2021, 5:53pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/12 "2021-04-20T17:53:07Z")

</div>

I can start a new thread but just curious now that I have it all working.

`[[u'Compact 5480', True, u'Connected', u'LogixDriver'], [u'SimValues', True, u'Running', u'ProgrammableSimulatorDevice'], [u'Moxa Port 502', True, u'Connected', u'ModbusRtuOverTcp']] `

Why am I getting a u’ in front of 3/4 of the columns? Is that from ignition?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 20, 2021, 6:52pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/13 "2021-04-20T18:52:54Z")

</div>

No, that’s a Python (2) ism. `u` in front of a string literal (you can also provide it yourself, e.g. `myString = u'Λορεμ ιπσθμ δολορ'` is valid code) means that it’s a “Unicode” string - normal Python strings can only hold the 255 characters in the standard ASCII range, which has obvious problems for internationalization/localization. Most Ignition APIs should default to returning Unicode strings.  
As a consumer of the values in scripting, you shouldn’t ever really have to care; a Unicode string acts just like a “regular” ASCII string.

---

<div class="post-metadata">

**Author:** ![clifford.ayer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/clifford.ayer/32/78030_2.png) [@clifford.ayer](https://forum.inductiveautomation.com/u/clifford.ayer)\
**Post date:** [April 29, 2021, 3:03pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/14 "2021-04-29T15:03:13Z")

</div>

I faced this same issue, only with “system”, as in “system.util.getLogger”.

I had originally written the script on another server and copy-and-pasted the script to my new project. My guess is that there other hidden data attached to the script when copying from the Project Library to another. I copied the Project Script contents to NotePad++ → Deleted the Script from the Project Library → created a brand new Script with a slightly different Name (e.g. “amr\_stats” to “amrStats”) → pasted the copied, old Script. Lo and Behold, the error messages disappeared.

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [May 26, 2022, 6:15pm UTC](https://forum.inductiveautomation.com/t/scripting-console-error/45819/15 "2022-05-26T18:15:56Z")

</div>

I just upgraded to Ignition 8.1.17  
I find it interesting that if I have a syntax error in my Project Library script, the Script Console displays the error.

```auto
ImportError: Cannot import site module and its dependencies: Error loading module GEO: NameError: name 'x' is not defined
Determine if the following attributes are correct:
  * sys.path: [C:\Users\lynn.martineau\.ignition\cache\gwotc-mesopc01_8088\C0\pylib, C:\Users\lynn.martineau\.ignition\cache\resources\platform\jython-ia-2.7.2.1.jar\00000000A5AE7F4C\Lib, __classpath__ , __pyclasspath__ /]
    This attribute might be including the wrong directories, such as from CPython
  * sys.prefix: C:\Users\lynn.martineau\.ignition\cache\resources\platform\jython-ia-2.7.2.1.jar\00000000A5AE7F4C
    This attribute is set by the system property python.home, although it can
    be often automatically determined by the location of the Jython jar file

You can use the -S option or python.import.site=false to not import the site module

```

In this case, I had an “x” in column 1 where a “def” would normally be.
