I am trying to run to cmd code using python.
p = 'calcifer --config="C:\\Users\\yilin.chen\\Desktop\\pythonminingstuff\\calcifer\\calcifer\\pipelines\\run_config.yaml"'
subprocess.call('cd C:\\Program Files (x86)\\Olympus\\Vanta\\bin', shell = True)
subprocess.call(p, shell = True)
And later I found that, these two line of code should be ran together. So I tried
commands = """ SET foo=1 | SET foo=2 | echo %foo% """
b = subprocess.check_output(commands, shell=True)
print(b.decode('ascii'))
Which is posted here as a guide https://mail.python.org/pipermail/tutor/2013-January/093474.html But it doesn't work for me. The code above only executes the lasty line which prints a %foo%.If I copy and paste the orirginal code, it only prints 'hello'.
Any thoughts? I appreciate your help.