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. Use pyuic5 to transfer .ui to .py, get Error in input file: not well-formed (invalid token): line 1, column 1
Forum Updated to NodeBB v4.3 + New Features

Use pyuic5 to transfer .ui to .py, get Error in input file: not well-formed (invalid token): line 1, column 1

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for python
6 Posts 3 Posters 8.5k Views 1 Watching
  • 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
    SoleyRan
    wrote on 26 Apr 2020, 15:00 last edited by
    #1

    Hi everyone, I just start to use pyqt. I tried to use pyuic5 to transfer .ui to .py:

    pyuic5 -o mainwindow.py mainwindow.ui
    

    but it got error:

    Error in input file: not well-formed (invalid token): line 1, column 1
    

    the head part of the ui file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>Form</class>
     <widget class="QWidget" name="Form">
      <property name="geometry"> 
    ...
    

    I have installed pyqt5, pyqt5-tools. I searched online but not find solution yet. Please help me! Thanks in advance!

    J 1 Reply Last reply 27 Apr 2020, 05:52
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 26 Apr 2020, 17:51 last edited by
      #2

      Hi,

      How did you create that .ui file ?
      What was the version of the tool ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 27 Apr 2020, 04:35
      0
      • S SGaist
        26 Apr 2020, 17:51

        Hi,

        How did you create that .ui file ?
        What was the version of the tool ?

        S Offline
        S Offline
        SoleyRan
        wrote on 27 Apr 2020, 04:35 last edited by
        #3

        Hi @SGaist, I used designer.exe in pyqt5-tools to create .ui file. The pyqt5 version is 5.13.0, qt5 version is 5.13.0, python version is 3.6.4

        1 Reply Last reply
        0
        • S SoleyRan
          26 Apr 2020, 15:00

          Hi everyone, I just start to use pyqt. I tried to use pyuic5 to transfer .ui to .py:

          pyuic5 -o mainwindow.py mainwindow.ui
          

          but it got error:

          Error in input file: not well-formed (invalid token): line 1, column 1
          

          the head part of the ui file is:

          <?xml version="1.0" encoding="UTF-8"?>
          <ui version="4.0">
           <class>Form</class>
           <widget class="QWidget" name="Form">
            <property name="geometry"> 
          ...
          

          I have installed pyqt5, pyqt5-tools. I searched online but not find solution yet. Please help me! Thanks in advance!

          J Offline
          J Offline
          JonB
          wrote on 27 Apr 2020, 05:52 last edited by
          #4

          @SoleyRan
          It seems that error message can occur even if the actual error is late in the file. You could make a change in the Designer to force resave and check again. What about reading the .ui file into an XML editor to see if that complains about it, with a more specific error?

          S 1 Reply Last reply 27 Apr 2020, 14:14
          1
          • J JonB
            27 Apr 2020, 05:52

            @SoleyRan
            It seems that error message can occur even if the actual error is late in the file. You could make a change in the Designer to force resave and check again. What about reading the .ui file into an XML editor to see if that complains about it, with a more specific error?

            S Offline
            S Offline
            SoleyRan
            wrote on 27 Apr 2020, 14:14 last edited by
            #5

            @JonB Thank you for the reply. I modified the .ui file but it still occurred error. I thought it might because of the designer version problem, so I changed to use Qt creator to generate .ui file, finally it worked. It was weird because my Qt version is also 5.13.0, the same as pyqt5-tools...

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 27 Apr 2020, 18:15 last edited by
              #6

              Do you have several versions installed ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              26 Apr 2020, 15:00

              • Login

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