[Scons-users] Acccessing environment variables

Gary Oberbrunner garyo at oberbrunner.com
Wed Sep 10 11:11:46 EDT 2014


On Wed, Sep 10, 2014 at 10:49 AM, Florian Lindner <mailinglists at xgm.de>
wrote:

> Hello,
>
> I have created my environment with:
>
> env = Environment(variables = vars, ENV = os.environ)
>
> I expect that I can access all env variables that are available on shell
> too, but:
>
> (set a pdb.set_trace() below setting env like above)
>
> (Pdb) os.environ["PETSC_DIR"]
> '/data2/scratch/lindner/petsc'
> (Pdb) env["PETSC_DIR"]
> *** KeyError: 'PETSC_DIR'
>
> What is wrong there? Probably with my understanding... ;-)
>

Yup! :-)

Check env['ENV']['PETSC_DIR'].  That's the shell environment that will be
passed to subprocesses.

-- 
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20140910/0e4b744f/attachment.html>


More information about the Scons-users mailing list