pyuic5.exe 不输出任何内容并清除输入文件

pyuic5.exe doesnt output anything and clears the input file

这是一个小测试,我试图通过 pyuic5 转换为 python 代码:

https://pastebin.com/rBDKhvCV

像这样使用我的 Venv 中脚本文件夹中的 pyuic5.exe 时:

(Test) C:\Users\Administrator\Documents\Test\Repo>..\Scripts\pyuic5.exe -o Test.ui QtOutput.py

我得到这个输出:

Error in input file: no element found: line 1, column 0

之后,QtOutput.py 仍然是空的,但是 Test.ui 不再包含 "designer code",而是只有这个:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'QtOutput.py'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!

这是什么?为什么它不起作用?我认为我所做的一切都与在线文档完全一样吗? (使用 https://python-forum.io/Thread-Convert-ui-file-py 的人所说的)

提前致谢!

pyuic的正确用法是:

pyuic5 -o target_py_file.py my_ui_file.ui

您目前正在告诉 pyuic 处理 QtOutput.py 文件并将输出写入 Test.ui 文件。

The -o option stands for 'output'