I have a pretty interesting problem regarding environment variables, and googling around didn't show me any meaningful results:
$ echo $BUCKET && python -c "import os; print os.environ['BUCKET']" mule-uploader-demo Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'BUCKET' So I have an environment variable that is available in bash but not inside python. How can this happen and how do I fix it? Here are some additional details:
- The environment variable is set through a
source envvars.shcommand - The
envvars.shfile contains only lines that look like this:KEY=value - I've reproduced this in both bash and zsh
- If I do an
export BUCKET=$BUCKET, it works
env | grep BUCKET? if it's not exported it won't be available to child processes.echo $BUCKET