# \[SOLVED\] Import error when opening script console

**URL:** <https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [September 3, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375 "2020-09-03T21:58:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [September 3, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/1 "2020-09-03T21:58:16Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 24, 2020, 9:13pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/2 "2020-09-24T21:13:33Z")

</div>

> [@bmeyers](#):
>
> C:\Users\ASA.ignition\cache\

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

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 2, 2020, 12:28am UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/3 "2020-10-02T00:28:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jon.fjolnir.hjartar](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jon.fjolnir.hjartar](https://forum.inductiveautomation.com/u/jon.fjolnir.hjartar)\
**Post date:** [January 2, 2021, 2:09pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/4 "2021-01-02T14:09:49Z")

</div>

> [@Kevin.Herron](#):
>
> If you close the designer, delete this directory, then launch it again - does it still occur?

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).

---

<div class="post-metadata">

**Author:** ![joe.friedrich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe.friedrich/32/7505_2.png) [@joe.friedrich](https://forum.inductiveautomation.com/u/joe.friedrich)\
**Post date:** [February 21, 2022, 5:09pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/5 "2022-02-21T17:09:10Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 23, 2022, 10:40pm UTC](https://forum.inductiveautomation.com/t/solved-import-error-when-opening-script-console/38375/6 "2022-02-23T22:40:15Z")

</div>

FYI I deleted this folder:

```auto
C:\Program Files\Inductive Automation
```
