Closed YunchengLiu closed 1 year ago
I was facing the same problem, turns out, it's easy to solve
First, go into the extension settings in VS Code.
Locate the setting "Qt For Python › Uic: Path", for me it was the last setting.
Put the path of the uic.exe
executable in it, NOT the pyside6-uic.exe
, in the issue I saw you put C:/Miniconda3/envs/qt/Scripts/pyside6-uic.exe
, whereas it should have been
C:/Miniconda3/envs/qt/Lib/site-packages/PySide6/bin/uic.exe
If the folder bin
does not exist in that directory, just create the bin
folder and move the uic.exe
file inside of it.
(the uic.exe
file should be in C:/Miniconda3/envs/qt/Lib/site-packages/PySide6/uic.exe
)
Once all of this is done, you can close VS Code and restart it, and you should be able to compile the .ui
file.
NOTE If you want to compile it into Python code and not C++, you have to do 1 more step.
Go to the extension settings in VS Code and look for the setting Qt For Python › Uic: Options
, for me it was right above the previous one.
And add the next line -g python
.
That should be it.
Thanks! i solved it!
Glad its sorted!
I installed Pyside6 in a new conda environment via
conda install pyside6
, and i config this plugin as follows.I created a new ui file, which can be opened through the designer, but when I right-click and select Compile Qt UI File in the VSCode file browser, the output is (Sorry for some garbled characters, I don't know why):
**Traceback (most recent call last): File "C:\Miniconda3\envs\qt\Scripts\pyside6-uic-script.py", line 10, in
sys.exit(uic())
^^^^^
File "C:\Miniconda3\envs\qt\Lib\site-packages\PySide6\scripts\pyside_tool.py", line 83, in uic
qt_tool_wrapper("uic", ['-g', 'python'] + sys.argv[1:], True)
File "C:\Miniconda3\envs\qt\Lib\site-packages\PySide6\scripts\pyside_tool.py", line 49, in qt_tool_wrapper
proc = Popen(cmd, stderr=PIPE)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Miniconda3\envs\qt\Lib\subprocess.py", line 1024, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Miniconda3\envs\qt\Lib\subprocess.py", line 1509, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] ϵͳ�Ҳ���ָ�����ļ���
Command failed: C:/Miniconda3/envs/qt/Scripts/pyside6-uic.exe -o "d:_Code\MetaHoloPolar\qt_out\ui_untitled.py" d:_Code\MetaHoloPolar\untitled.ui Traceback (most recent call last): File "C:\Miniconda3\envs\qt\Scripts\pyside6-uic-script.py", line 10, in
sys.exit(uic())
^^^^^
File "C:\Miniconda3\envs\qt\Lib\site-packages\PySide6\scripts\pyside_tool.py", line 83, in uic
qt_tool_wrapper("uic", ['-g', 'python'] + sys.argv[1:], True)
File "C:\Miniconda3\envs\qt\Lib\site-packages\PySide6\scripts\pyside_tool.py", line 49, in qt_tool_wrapper
proc = Popen(cmd, stderr=PIPE)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Miniconda3\envs\qt\Lib\subprocess.py", line 1024, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Miniconda3\envs\qt\Lib\subprocess.py", line 1509, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] ϵͳ�Ҳ���ָ�����ļ���**
I am in the python environment, manually using
python pyside6-uic-script.py file.ui > ui_file.py
can compile successfully.I want to know how to solve this problem, thanks a lot