Adding environment variables to bash.
mail at johnlawrence.net
Thu Sep 11 12:51:53 CEST 2008
> doesn't exactly work for Python scripts, though:
True, but you can use it in the following (admittedly messy) way:
jl> cat setenv.sh
/usr/bin/env python $@
jl> cat env.py
command = "export TEST='hello'\n"
jl> . setenv.sh env.py && env | grep TEST
Note this won't set the environment variable until the end of the script, so
if it's used in the script as well then it'll also need to be set with, for
example, os.environ["TEST"] = "hello"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list