0

I'm using VS2012 and are trying to setup an automatic build using python. I am trying something like this

cmd =  'msbuild /p:Configuration=Release INSTALL.vcxproj'
print cmd
output = subprocess.check_output(cmd, shell=True)

But it fails becuase the subprocess don't have proper environment variables.

How do I create a process with the environment variables set in vcvars32.bat ?

Totte Karlsson
  • 1,261
  • 1
  • 20
  • 55
  • possible duplicate of [How to get environment from a subprocess in Python](http://stackoverflow.com/questions/1214496/how-to-get-environment-from-a-subprocess-in-python) – David Heffernan Jan 20 '14 at 17:26
  • 1
    The accepted answer at that question is not much use IMHO. However, the highest voted answer is good. I use that exact code to do precisely what you are trying to do here. On the other handle, you can perfectly well do this: `cmd /c call vcvars32.bat && msbuild ...` (you need to fill in the details) and that works fine too. – David Heffernan Jan 20 '14 at 17:28
  • Thanks for the pointers. I'll check those out. – Totte Karlsson Jan 20 '14 at 17:38

0 Answers0