Important: Please read the Qt Code of Conduct -

Error: xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1

  • Hey guys,

    i wrote a little application with pyqt5 and it worked fine. But today suddenly i can't run the application. I get the following error:

    Traceback (most recent call last):
      File "C:/Users/hrezaie/Desktop/Hamid Rezaie/GuiApp/GuiApp/", line 768, in <module>
        w = Fenster()
      File "C:/Users/hrezaie/Desktop/Hamid Rezaie/GuiApp/GuiApp/", line 29, in __init__
        loadUi(r'C:\Users\hrezaie\Desktop\Hamid Rezaie\GuiApp\GuiApp\guiapp.ui', self)
      File "C:\Users\hrezaie\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyQt5\uic\", line 237, in loadUi
        return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
      File "C:\Users\hrezaie\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyQt5\uic\Loader\", line 66, in loadUi
        return self.parse(filename, resource_suffix)
      File "C:\Users\hrezaie\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PyQt5\uic\", line 1020, in parse
        document = parse(filename)
      File "C:\Users\hrezaie\AppData\Local\Programs\Python\Python38-32\lib\xml\etree\", line 1202, in parse
        tree.parse(source, parser)
      File "C:\Users\hrezaie\AppData\Local\Programs\Python\Python38-32\lib\xml\etree\", line 595, in parse
        self._root = parser._parse_whole(source)
    xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1
    Process finished with exit code 1

    I tryed to solve it but i can't. Has anybody an idea how i can solve it ?

  • Lifetime Qt Champion

    @elias_hh Are you parsing a XML document in your app? Is this document still valid XML?

  • @jsulm Hey, no i dont use any XML document. I think the problem is my .ui file. Because if i want to open it with qt designer i get suddenly a error message to.

  • Lifetime Qt Champion

    @elias_hh So, check the content of that ui file

  • @jsulm i ifix the problen, thank u.

  • Lifetime Qt Champion

    What was it ? Just so others might also be able to fix it.

  • @mrjj hey, unfortunately I didn't solve it in a nice way, but simply recreated the gui again. Afterwards it worked again.

  • Lifetime Qt Champion

    well still a solution. :) thank you.

Log in to reply