Skip to content

AttributeError: module 'xml.etree.ElementTree' has no attribute 'cleanup_namespaces' #20

@Suitx

Description

@Suitx

Hi there, having trouble getting formation to work.

Here is what I've done to run into this issue:

  1. Starting Formation studio and directly saving the dialog window to simple.xml results in errors printed into console
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\hoverset\data\actions.py", line 43, in invoke
    return self._func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\studio\main.py", line 576, in save
    path = self.context.save()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\studio\feature\design.py", line 811, in save
    path = self.designer.save(new_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\studio\feature\design.py", line 353, in save
    self.builder.write(self.design_path)
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\studio\parsers\loader.py", line 395, in write
    dump.write(file_loader(node=self.root).generate(**pref.get(pref_path)))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\formation\formats\_xml.py", line 90, in generate
    etree.cleanup_namespaces(x_node, top_nsmap=namespaces)
    ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'xml.etree.ElementTree' has no attribute 'cleanup_namespaces'
  1. Afterwards, running the generated xml results in the following console output:
from formation import AppBuilder
app = AppBuilder(path="simple.xml")
app.mainloop()
Traceback (most recent call last):
  File "C:\Projekte\Lightanimations\Playground\POC_tkinter\test_tkinter.py", line 12, in <module>
    app = AppBuilder(path="simple.xml")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\formation\loader.py", line 489, in __init__
    super().__init__(self._app, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\formation\loader.py", line 265, in __init__
    self.load_path(self._path)
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\formation\loader.py", line 427, in load_path
    tree.load()
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\formation\formats\_xml.py", line 82, in load
    x_node = etree.parse(file).getroot()
             ^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\xml\etree\ElementTree.py", line 1218, in parse
    tree.parse(source, parser)
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\xml\etree\ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

My setup:
image

Any advice what's wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions