subprocess & shared environments
rcdailey at gmail.com
Tue May 5 04:25:42 CEST 2009
On May 1, 4:18 pm, Aaron Brady <castiro... at gmail.com> wrote:
> On May 1, 12:09 am, Robert Dailey <rcdai... at gmail.com> wrote:
> > I'm currently calling subprocess.call() on a batch file (in Windows)
> > that sets a few environment variables that are needed by further
> > processes started via subprocess.call(). How can I persist the
> > environment modifications by the first call() function? I've done my
> > own searching on this and I came up with nothing.
> > Help is appreciated.
> I don't know if this will work, but you can try spawning a batch file
> that calls the first program to set the variables, then executes the
> second program. You might need to create that batch file by hand, as
> well as the command line for the second process.
> You can also try setting the env. variables in the parent process, and
> restoring them after.
Thanks for your help guys. Unfortunately both ideas will not work. I
guess I should have mentioned that the batch file in question is
vsvars32.bat, from the Visual Studio installation directory. I should
not modify this file, nor can I create a "wrapper" batch file as you
suggested, since I call several other batch files at different times.
There's about 6 other nmake calls I make that each is preceeded with a
call to vsvars32.bat. For now I'm using the && DOS operator, this
seems to work, however it is not ideal.
More information about the Python-list