Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97032

Re: Modify environment variable for subprocess

Date 2015-09-23 20:00 +1000
From Cameron Simpson <cs@zip.com.au>
Subject Re: Modify environment variable for subprocess
References <6f8c6233-9777-488f-9026-fec729fef6d1@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.97.1443003590.28679.python-list@python.org> (permalink)

Show all headers | View raw


On 23Sep2015 02:51, loial <jldunn2000@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@zip.com.au>

Tachyon: A gluon that's not completely dry.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Modify environment variable for subprocess loial <jldunn2000@gmail.com> - 2015-09-23 02:51 -0700
  Re: Modify environment variable for subprocess Cameron Simpson <cs@zip.com.au> - 2015-09-23 20:00 +1000
  Re: Modify environment variable for subprocess Laura Creighton <lac@openend.se> - 2015-09-23 12:37 +0200
  Re: Modify environment variable for subprocess Akira Li <4kir4.1i@gmail.com> - 2015-09-24 03:12 +0300

csiph-web