Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Error in input file: not well-formed (invalid token): line 1, column 0 when trying to export a .ui file to a .py file
Forum Updated to NodeBB v4.3 + New Features

Error in input file: not well-formed (invalid token): line 1, column 0 when trying to export a .ui file to a .py file

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 3 Posters 935 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shinic
    wrote on 31 Jul 2024, 01:04 last edited by
    #1

    Hey,
    Im quite new to creating GUI's and I'm working on a project where I need one. I created a ui.qml file, then went ahead and saved it as an .ui file. I then proceeded to use the

    pyuic5 -x test.ui -o test.py
    

    command to convert the .ui file into a .py file. After executing I got greeted with an error message saying "Error in input file: not well-formed (invalid token): line 1, column 0".

    I also tried not converting the .ui file and using

    from PyQt5 import uic and uic.loadUi('test.ui', self)
    

    in a python file in hopes to fix it, but it didnt work either. I pretty much got the same error that way only this time it was worded a bit differently, "xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0".

    Does anyone know a possible fix for my situation?
    For reference:

    • System is a M1 Macbook pro 2020
    • Python version: 3.11.7
    • PyQT5 version: 5.15.10
    J 1 Reply Last reply 31 Jul 2024, 05:11
    0
    • S shinic
      31 Jul 2024, 01:04

      Hey,
      Im quite new to creating GUI's and I'm working on a project where I need one. I created a ui.qml file, then went ahead and saved it as an .ui file. I then proceeded to use the

      pyuic5 -x test.ui -o test.py
      

      command to convert the .ui file into a .py file. After executing I got greeted with an error message saying "Error in input file: not well-formed (invalid token): line 1, column 0".

      I also tried not converting the .ui file and using

      from PyQt5 import uic and uic.loadUi('test.ui', self)
      

      in a python file in hopes to fix it, but it didnt work either. I pretty much got the same error that way only this time it was worded a bit differently, "xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0".

      Does anyone know a possible fix for my situation?
      For reference:

      • System is a M1 Macbook pro 2020
      • Python version: 3.11.7
      • PyQT5 version: 5.15.10
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 31 Jul 2024, 05:11 last edited by
      #2

      @shinic Open the ui file in a hex editor and check what is right at the beginning of the file.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • F Offline
        F Offline
        friedemannkleint
        wrote on 31 Jul 2024, 08:43 last edited by friedemannkleint
        #3

        You are mixing up QML and QtWidgets ;-) .ui.qml files are for use with QQmlEngine, , see QML vs widets .

        1 Reply Last reply
        3

        1/3

        31 Jul 2024, 01:04

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved