[issue24971] os.environ.get() does not return the Environment Value in Linux

Francis Greaves report at bugs.python.org
Mon Aug 31 22:18:36 CEST 2015


Francis Greaves added the comment:

erykson's example works perfectly.
I have a script as follows

#!/bin/python
#
import os
cmd = os.environ.get('XRIT_DECOMPRESS_PATH')
print cmd

resulting in 'None'

and if I substitute this line
cmd = os.environ.get('PATH')

resulting in '/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.4:/usr/include/KDE'

however from the bash prompt
$ echo $XRIT_DECOMPRESS_PATH
results in '/usr/local/bin/xRITDecompress' so the environment variable  is there and available in bash, but not in Python.
I find this very strange

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24971>
_______________________________________


More information about the Python-bugs-list mailing list