I have been trying to run SAM CLI to build and run a local api through Python.
There seems to be a difference between using the executable parameter in the subprocess.Popen function vs having the path to the exe as the first item in the args list. I think this because SAM CLI is returning different responses depending on the method I have used. What is the difference between the two approaches I am taking? Why does the first method fail?
First method
subprocess.call(["build", "-u"], cwd=cwd, stdout=f, stderr=f, shell=False, executable=exe)
Fails and returns: Error: no such option: -u
Second method
subprocess.call([exe, "build", "-u"], cwd=cwd, stdout=f, stderr=f, shell=False)
Works and runs through the process.
exe stores the path to 'sam.exe'