Modify environment variable for subprocess
Cameron Simpson
cs at zip.com.au
Wed Sep 23 06:00:41 EDT 2015
On 23Sep2015 02:51, loial <jldunn2000 at gmail.com> wrote:
>I need to modify the LIBPATH environment variable when running a process via subprocess, but otherwise retain the existing environment.
>
>Whats the best way to do that?
Make a copy of os.environ, modify the copy, pass it via the env=parameter of
subprocess.Popen. That is the most direct and controllable method.
Cheers,
Cameron Simpson <cs at zip.com.au>
Tachyon: A gluon that's not completely dry.
More information about the Python-list
mailing list