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


Groups > comp.lang.python > #97032

Re: Modify environment variable for subprocess

Path csiph.com!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'modify': 0.04; 'method.': 0.05; 'that?': 0.05; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'simpson': 0.16; 'subject:variable': 0.16; 'subprocess,': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'cheers,': 0.22; 'pass': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'environment': 0.29; 'retain': 0.33; 'running': 0.34; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'environment.': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'cameron': 0.66; 'direct': 0.68; 'received:61': 0.72; 'controllable': 0.84
X-Authentication-Info Submitted using ID cskk@bigpond.com
X-Authority-Analysis v=2.0 cv=CsQ9gwED c=1 sm=1 a=RdxqkbulLQ60fYKT7Q76Zw==:17 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=ff-B7xzCdYMA:10 a=pGLkceISAAAA:8 a=nfqow0h7oDrP0yYiAugA:9 a=CjuIK1q_8ugA:10 a=RdxqkbulLQ60fYKT7Q76Zw==:117
Date Wed, 23 Sep 2015 20:00:41 +1000
From Cameron Simpson <cs@zip.com.au>
To python-list@python.org
Subject Re: Modify environment variable for subprocess
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Disposition inline
In-Reply-To <6f8c6233-9777-488f-9026-fec729fef6d1@googlegroups.com>
User-Agent Mutt/1.5.23 (2014-03-12)
References <6f8c6233-9777-488f-9026-fec729fef6d1@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.97.1443003590.28679.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1443003590 news.xs4all.nl 23764 [2001:888:2000:d::a6]:38549
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:97032

Show key headers only | 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