I’ve got a similar issue to this or this. When I try to open my scripting console in Designer, I get import errors. In my case, it looks like it didn’t import all of our custom scripting libraries, and cross references are complaining of missing definitions:
Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) [OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java11.0.6 >>> ImportError: Cannot import site module and its dependencies: Error loading module ranger_profiles: Traceback (most recent call last): File "<module:ranger_profiles>", line 10, in <module> NameError: name 'ranger_tiles' is not defined Determine if the following attributes are correct: * sys.path: [/home/justin/.ignition/cache/gwXXX_443/C0/pylib, /home/justin/.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: /home/justin/.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 >>>
In our case, both
ranger_profiles are project library scripts, and definitely do reference each other at those lines. To clarify, none of our project library scripts ever import each other explicitly, and they all run just fine on the gateway. This issue is only in the Designer script console.
I tried closing down designer and removing
~/.ignition/cache, but that didn’t seem to help.
As an interesting data point, if I connect to a different Ignition server which has the exact same projects (production vs development), I do not get the same issue. This seems to be related to this particular server?
EDIT: The other server is now also showing the same issue since I deleted
~/.ignition/cache? Or maybe it was coincidental? I definitely saw different behavior when I connected to each server this morning compared to now. Should I be able to find the contents of my project library somewhere under
RE-EDIT: If I check for those libraries from the interactive console, it shows them existing as Jython console modules. But if I try running scripts that cross-reference, I can interactively create a similar error again:
>>> type(signalfire_nodes) <type 'com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleModule'> >>> type(ranger_profiles) <type 'com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleModule'> >>> type(ranger_tiles) <type 'com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleModule'> >>> Traceback (most recent call last): File "<input>", line 5, in <module> File "<module:homepage_helper>", line 2, in generate_main_page_table_fromMetricList NameError: global name 'signalfire_nodes' is not defined >>>
BIG-PICTURE QUESTIONS: How is Ignition importing project libraries? What scope do they exist in? How is this different on the gateway versus in the script console? Why don’t we normally have to import our project libraries in each other when they cross-reference?