# xml.etree.ElementTree: etree Not Found

**URL:** <https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [May 8, 2023, 5:03pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426 "2023-05-08T17:03:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [May 8, 2023, 5:03pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/1 "2023-05-08T17:03:23Z")

</div>

A very strange thing happened to me today.  
I wanted to run this script (from the button and from the script console) with xml.etree.ElementTree, but it says that it cannot be found:

 ![Screenshot_14](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/3/f37f6fde19b8903f2956d5c128cb05adf8d58cdb.png)  
Ignition v8.1.26 on windows server 2019.

This is a sample script from the manual about parsing XML...

I've checked that ElementTree.py exists in the folder named xml.  
I've also "upgraded" the gateway with the same version, but no luck.  
I've also deleted the .ignition cache folder, but no go.

I have a fairly big project on this gateway, and everything is working fine.  
This xml script is only for testing something else, not related to the project on the gateway.

But I'd still like to know why it doesn't work...  
Any suggestions?

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [May 9, 2023, 4:32pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/2 "2023-05-09T16:32:19Z")

</div>

Huh... nobody....?  
@paul-griffith maybe... or @Kevin.Herron ...

---

<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:** [May 9, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/3 "2023-05-09T16:34:15Z")

</div>

I've seen this issue with etree before, but never consistently, it's always been a periodic thing that happens in client sessions at runtime. The prevailing thought was that it's some kind of classloader race condition, and we thought we'd squashed it. You're having it _consistently_ happen? That's different, and a bit weird. You're not doing anything like launching async threads, right?

I would contact support, probably. I don't have many other ideas off the top of my head.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [May 9, 2023, 4:44pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/4 "2023-05-09T16:44:50Z")

</div>

You gave me an idea...  
I created a new project (empty) with one window and a button with this script in it.  
Run designer preview and it works...!?!?  
How is that...possible?

---

<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:** [May 9, 2023, 4:52pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/5 "2023-05-09T16:52:00Z")

</div>

I don't ever use the jython xml libraries. I use java's native support, with minimal wrappers:

[https://www.automation-pros.com/ignition/xml.py](https://www.automation-pros.com/ignition/xml.py)

Use one of `strToDoc()`, `bytesToDoc()`, or `inputToDoc()` to generate a DOM. Use java's [native DOM operations](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Document.html) to extract what you wish.

I would expect this to be dramatically faster than any jython library, too.

Don't ask about the Vision stuff at the end. Enjoy it if you are so inclined.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [May 9, 2023, 5:06pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/6 "2023-05-09T17:06:07Z")

</div>

> [@pturmel](#):
>
> Don't ask about the Vision stuff at the end

What do you mean by that? I work only in Vision... I'm to old to learn Perspective, CSS, HTML,... that's for 'young' people...

> [@pturmel](#):
>
> Enjoy it if you are so inclined.

And this...?

---

<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:** [May 9, 2023, 5:42pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/7 "2023-05-09T17:42:32Z")

</div>

> [@zxcslo](#):
>
> What do you mean by that?

Read the comments. If it is gibberish to you, you can ignore them. (:

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [May 12, 2023, 6:08am UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/8 "2023-05-12T06:08:28Z")

</div>

I've figured out what was wrong:  
I've put @pturmel xml script to project library under the name 'xml'...

 ![Screenshot_84](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e7e85305cd218d2772355813215bdc937dd215d4.png)  
And that conflicts with the `import xml.etree.ElementTree as ET` since the folder in pylib is also named 'xml'...  
I changed the project library script to 'xml2' and now you can import python/jython xml...  
 ![Screenshot_85](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c202f1e674a63fb1e06b52d190af50ba4c54b3d2.png)

---

<div class="post-metadata">

**Author:** ![msteele](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/msteele/32/77889_2.png) [@msteele](https://forum.inductiveautomation.com/u/msteele)\
**Post date:** [February 27, 2024, 8:28pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/9 "2024-02-27T20:28:40Z")

</div>

Yep I'm having the same issue, trying to load the Icon Manager from Exchange into a project that inherits from a project containing @pturmel's `xml` project library script. But if I have Icon Manager in a standalone project, it works fine.

Is there a way to alias these imported libraries somehow so I can just rename calls to `xml.etree.ElementTree as ET` without renaming the `xml` script as @zxcslo did? I'm sure this would work better with @pturmel's great `xml` script linked above, but I'm not interested in refactoring a rarely-used backend utility to manage icon sets.

---

<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:** [February 27, 2024, 9:44pm UTC](https://forum.inductiveautomation.com/t/xml-etree-elementtree-etree-not-found/73426/10 "2024-02-27T21:44:49Z")

</div>

You can bump my library into `somePackage.xml` if necessary. But it's better to not use jython stdlib.
