loial <jldunn2...@gmail.com> writes:

> 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?

Pass env=dict(os.environ, LIBPATH=value) parameter:

  import os
  import subprocess 
  
  subprocess.check_call('echo $LIBPATH', shell=True,
                        env=dict(os.environ, LIBPATH='/some/path'))


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to