[SOLVED] Import error when opening script console

Good evening,

I get the following error when opening the Script Console. I recently upgraded Ignition from 8.0.7 to 8.0.16.

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

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

Determine if the following attributes are correct:

sys.path: [C:\Users\.ignition\cache\gwlocalhost_8088\C0\pylib, C:\Users\ASA\.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\.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

It looks like the following path doesn’t have a Lib… but I don’t know what that means for me.

 C:\Users\.ignition\cache\resources\platform\jython-2.7.1-ia5.jar\000000001498F8CC\Lib
1 Like

If you close the designer, delete this directory, then launch it again - does it still occur?

1 Like

I did a combination of this… uninstalled, deleted my ignition folder, and reinstalled.

I have a similar/identical error after restarting the server.
Deleting the cache did not work for me.
I was installing and importing a few python libs according to other posts, basically:
-installing jython 2.7.1
-linking C:\Program Files\Inductive Automation\Ignition\user-lib\site-packages to C:\jython2.7.1\Lib\site-packages

The imported libraries were working before the restart so I don’t really know what went wrong.
The script console does not seem to find the site-packages path anymore.

Anybody got a good way forward. I’d rather avoid re-installing. (running 8.0.17).

Kevin, I am getting a similar error, but (usually) for a library contained in pylib/site-packages.

To fix this we attempted the following:
We upgraded to Ignition 8.1.14 (was running 8.1.9). - Test failed.
I deleted the user/.ignition/<servername>/cache folder. - Test failed.
I uninstalled and reinstalled the Ignition Designer on my local PC. - Test failed.
Then I deleted the user/.ignition folder. - Test failed.

The only thing that seems to fix this is to edit and save a file in the /pylib/site-packages/ folder on the server.
(Usually I just add/remove whitespace from a comment.)
When I do this, the designer responds by loading the files again.
(Doesn’t always work the first time, but it works eventually.)

Question 1: Is there a way from the Designer side to tell it to attempt to reload pylib or site-packages so I don’t have to go out to the server and interrupt everyone else who is using a designer?

Question 2: Is there an open ticket/bug-tracker for this or a similar issue?

I can post a screenshot or provide more details if needed.

(or shoot me a quick reply if this should be a new Forum Topic)

FYI I deleted this folder:

C:\Program Files\Inductive Automation
1 Like