Introduction
I am trying to call a command ('nmake'
) that needs to be run from inside the VS Developer Command Prompt using Subprocess.Popen
in python.
Setting the path for it won't work for my case.
I tried reading the docs and it didn't seem like there is a way to use something other than the default CMD.exe.
My code
import subprocess
command = ['nmake']
with subprocess.Popen(["nmake"],
executable=r"C:Program Files (x86)Microsoft Visual Studio2019BuildToolsCommon7ToolsVsMSBuildCmd.bat",
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True) as process:
print(process.stdout.readlines())
print(process.stderr.readlines())
Exception
It currently throws
'nmake' is not recognized as an internal or external command
so it's not actually using the executable provided there.
Notes
System used : Windows 10, python3.8
question from:
https://stackoverflow.com/questions/65902953/call-a-command-in-the-vs-developer-command-prompt-programmatically 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…