# \[Bug\] Iterable Python import

**URL:** <https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994>\
**Category:** Ignition Early Access\
**Created:** [November 21, 2018, 1:15pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994 "2018-11-21T13:15:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [November 21, 2018, 1:15pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/1 "2018-11-21T13:15:24Z")

</div>

We are migrating a project from Ignition 7.9.3 to 8.  
In our project we import the "SocketServer" library. When we try to do the same in Ignition 8, the following error occurs:

> Traceback (most recent call last):  
> File "", line 1, in   
> File "C:\Users\***.ignition\cache\gwlocalhost\_80\_main\C0\pylib\SocketServer.py", line 132, in   
> import socket  
> File "C:\Users\***.ignition\cache\gwlocalhost\_80\_main\C0\pylib\socket.py", line 3, in   
> from \_socket import (  
> File "C:\Users\*\*\*.ignition\cache\gwlocalhost\_80\_main\C0\pylib\_socket.py", line 12, in   
> from collections import namedtuple, Iterable  
> ImportError: cannot import name Iterable

What do you suggest?  
Thank you.

---

<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:** [November 21, 2018, 1:22pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/2 "2018-11-21T13:22:26Z")

</div>

Ignition 8 has the latest version of jython, 2.7.1, instead of the ancient 2.5.3. You’ll have to replace external libraries with the appropriate newer version.

---

<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:** [November 21, 2018, 1:25pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/3 "2018-11-21T13:25:27Z")

</div>

jython 2.7.1 should still have the Iterable class in the collections module… something else might be going on. /-:

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [November 21, 2018, 7:44pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/4 "2018-11-21T19:44:52Z")

</div>

> [@andrea.morando](#):
>
> File "C:\Users\*\*\*.ignition\cache\gwlocalhost\_80\_main\C0\pylib\_socket.py", line 12, in

I was able to import and use SocketServer in the script console of the current 8.0 build. Due to changes in the jython library, it looks like you might be running into a cached version. Try deleting your `.ignition` cache, relaunch the designer/project and let us know if that resolved your issue.

Might also be worth trying the import in the script console in the designer to see if the same error occurs.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [November 21, 2018, 8:56pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/5 "2018-11-21T20:56:12Z")

</div>

Also, make sure you’re running the latest 8 build. The first release of the 8 beta had Jython 2.7.0, which had problems with the python socket library.

---

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [November 22, 2018, 7:58am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/6 "2018-11-22T07:58:16Z")

</div>

Thank you.  
Unfortunately the error is still present: I have deleted the cache, relaunched the designer and tried to import the library. This is the screenshot of the script console:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fa7039b8549bd5b9ffcba7211fef082e2721a434.png)

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [November 22, 2018, 7:16pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/7 "2018-11-22T19:16:33Z")

</div>

What 8.0 build version are you using?

---

<div class="post-metadata">

**Author:** ![Jenko](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jenko](https://forum.inductiveautomation.com/u/Jenko)\
**Post date:** [November 22, 2018, 10:28pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/8 "2018-11-22T22:28:58Z")

</div>

I’m also getting the same error.

Build: 8.0.0-beta0 (b2018112202)

I also cleared the ignition cache before trying.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/16c43d9735ecc055c38433d4a1a39a7ca77a0dbf.png)

---

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [November 23, 2018, 7:49am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/9 "2018-11-23T07:49:51Z")

</div>

8.0.0-beta0 (b2018112002)

---

<div class="post-metadata">

**Author:** ![ggross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ggross/32/12668_2.png) [@ggross](https://forum.inductiveautomation.com/u/ggross)\
**Post date:** [November 27, 2018, 1:58am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/10 "2018-11-27T01:58:23Z")

</div>

I am unable to duplicate this on the latest build on my Windows 10, Linux and Mac clean OS + clean Ignition installations. Is it possible to try the following just to be sure that everything is current?:

1. Update to the latest 8.0 nightly version
2. Download an install the latest version of the Client Launcher to ensure you have the latest Java code (we did have some issues with earlier versions of Java and our implementation of Jython)
3. Delete everything in your **%USERPROFILE%\.ignition\cache** directory
4. Open the Designer and try to import the library again in the Script console

Thanks,  
Garth

---

<div class="post-metadata">

**Author:** ![Jenko](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jenko](https://forum.inductiveautomation.com/u/Jenko)\
**Post date:** [November 28, 2018, 3:32am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/11 "2018-11-28T03:32:06Z")

</div>

Hi Garth,

The error seems to be specific to the collections module - it can’t import the Iterable class.

The \_socket.py file calls for this class on Line 12.

I’m not sure if this is an Ignition bundled python file or if I have included it myself.

Cheers  
Dan

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e8c7d743ea3a54e97e2b52c4a255da10b1be2988.png)

---

<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:** [November 28, 2018, 3:40am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/12 "2018-11-28T03:40:44Z")

</div>

> [@Jenko](#):
>
> I'm not sure if this is an Ignition bundled python file or if I have included it myself.

I suspect you have leftover customizations somewhere. That import works for me with build b2018111902.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2a2b3e50daf53241aeea265c5db2939491f292c3.png)

---

<div class="post-metadata">

**Author:** ![Jenko](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jenko](https://forum.inductiveautomation.com/u/Jenko)\
**Post date:** [November 28, 2018, 3:53am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/13 "2018-11-28T03:53:34Z")

</div>

Thanks @pturmel, i’ll clean install Ignition and the caches and hopefully my hidden customisations go away.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [November 28, 2018, 11:54pm UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/14 "2018-11-28T23:54:44Z")

</div>

An early build of Ignition 8 accidentally had two copies of collections, one that was a holdover from Jython 2.5, and one that’s the new one for Jython 2.7. I’m guessing you’re running into that issue.

Old one: \<ignition\_install\_dir\>/user-lib/pylib/collections (directory)  
New one: \<ignition\_install\_dir\>/user-lib/pylib/collections.py (file)

Python has the unfortunate (in this case) behavior of defaulting to looking in directories before looking in .py files for imports. This means the old folder is used, even if it doesn’t have the classes that the script needs inside.

In theory installing a later version of 8 beta would have cleaned up the old directory, but I’m guessing somehow that didn’t happen, and that folder is still there.

If the “collections” directory is still there in pylib, feel free to rename it or move it out of that directory. Ignition has a file monitor on that directory so it’ll know as soon as the change is made and will propogate it to any open designer and client nearly instantly. After you move that out, wait 30 seconds and try again.

(As a sidenote, if it’s working properly, collections.py will import \_abcoll.py, which adds Iterable to collections and makes it import-able.)

---

<div class="post-metadata">

**Author:** ![Jenko](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jenko](https://forum.inductiveautomation.com/u/Jenko)\
**Post date:** [November 29, 2018, 9:27am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/15 "2018-11-29T09:27:36Z")

</div>

Thanks Kevin, that was the case. I had a directory called collections and the collections.py file at the same time. The upgrade to the new nightly didn’t get rid of the directory but a clean install did.  
The class imports properly now.

Thanks

---

<div class="post-metadata">

**Author:** ![andrea.morando](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.morando/32/8039_2.png) [@andrea.morando](https://forum.inductiveautomation.com/u/andrea.morando)\
**Post date:** [November 30, 2018, 9:15am UTC](https://forum.inductiveautomation.com/t/bug-iterable-python-import/20994/16 "2018-11-30T09:15:38Z")

</div>

Thank you very much: the import works properly also on my side.
