I am trying to call pyuic5
with subprocess.Popen
to convert qt5 .ui files to python from within a python script on Windows.
command = "pyuic5 -x " + filein + " -o " + fileout
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=False, cwd=folderPath)
output = process.communicate()
Gives me the following error:
Traceback (most recent call last):
File "N:\My Documents\Code\Python Projects\Work projects\PyQtConverter\src\fonctions.py", line 36, in convert_qt_2_py
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=False, cwd=folderPath)
File "C:\Python35\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Python35\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
It seems the issue comes from calling pyuic5
(although it is recognized as a valid command with the windows cmd?).
Setting shell=True
solves the problem, but I've been reading that this option could be a security risk and is not recommended. Should I be doing things differently?