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:
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?
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.
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?
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...
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.