On 27 Mar 2016 17:01, "Ben Finney" <ben+pyt...@benfinney.id.au> wrote: > > Hongyi Zhao <hongyi.z...@gmail.com> writes: > > > I use the following code the update the os.environ: > > > > import os > > from subprocess import check_output > > > > # POSIX: name shall not contain '=', value doesn't contain '\0' > > output = check_output("source /home/werner/env-intel-toolchains.sh; > > env -0", shell=True, executable="/bin/bash") > > That will start a new process (running ‘/bin/bash’), then execute some > commands from a script file in that process. > > When that new process ends, any changes in its environment also > disappear.
...unless the subprocess prints them out or something. I think you skimmed the code and question a little too quickly. -- https://mail.python.org/mailman/listinfo/python-list