En Mon, 17 Nov 2008 21:27:09 -0200, rowen <[EMAIL PROTECTED]>
escribió:
I'd like to replace some shell scripts with Python, but one step of
the script modifies my environment in a way that the subsequent steps
require.
A simple translation to a few lines of subprocess.call(...) fails
because the first call modifies the environment, but the other lines
don't see it.
Is there a straightforward way to do this (without having to resort
to writing some of it as a shell script)?
The first subprocess modifies *its* environment and dies - the
modification is not seen by the caller process. I don't know of any way to
modify parent's environment.
You might "echo" the desired changes in the first subprocess, read them
from the parent process and modify the environment that will be passed to
later subprocesses. Perhaps someone else provides a more straightforward
solution...
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list