Use pyuic5 to transfer .ui to .py, get Error in input file: not well-formed (invalid token): line 1, column 1
-
wrote on 26 Apr 2020, 15:00 last edited by
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!
-
Hi,
How did you create that .ui file ?
What was the version of the tool ? -
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!
wrote on 27 Apr 2020, 05:52 last edited by@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? -
@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?wrote on 27 Apr 2020, 14:14 last edited by@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...
-
Do you have several versions installed ?
1/6