First: I know that anyone who wants to help will ask for code that demonstrates the error. That will require a ZIP of the project, and I don't see how to attach a file to a StackOverflow question. I'll be happy to upload the file when someone tells me how.
This is one of those things where "I didn't change anything, but it broke." The environment is Windows 10, Python 3.8, and PyCharm 2019.3.5.
I left the project in a fully debugged state a couple of weeks ago. Today I added a function definition and a call to it. Now the program fails when it tries to create a parser for an XML tree... before the new function is ever called.
Early in the script I import etree from xml:
from xml import etree
At the point of failure I try to create a parser:
_parser = etree.ElementTree.XMLParser(encoding="iso-8859-1")
The messages I get are:
Connected to pydev debugger (build 193.7288.30)
Traceback (most recent call last):
File "C:/Users/... /PartConfig/PartConfig.py", line 47, in <module>
_parser = etree.ElementTree.XMLParser(encoding="iso-8859-1")
AttributeError: module 'xml.etree' has no attribute 'ElementTree'
I have an "except" block, but it never gets executed because its scope is etree.ElementTree.ParseError.
Taken at face value, the error message is simply wrong. I know the script found etree.ElementTree because it ran past the import statement, and when I misspelled the module name as an experiment it failed right there. ElementTree is an element of xml.etree in the standard Python library, so I can't think of a way the script could fail the way it did. The message must be trying to tell me something, but what?