Problem using os.environ.get

paragon.john at gmail.com paragon.john at gmail.com
Wed Nov 14 11:12:23 EST 2007


Hello,

I am trying to retrieve a linux environment variable using
os.environ.get, however it does not appear to be working properly. It
returns none for a variable that does, in fact exist.

# echo $HOSTTYPE
x86_64
# python
>>> import os
>>> print os.environ.get('HOSTTYPE')
None

If I do the same thing with a different variable (XILINX, in this
case), it works fine.

# echo $XILINX
/Xilinx
# python
>>> import os
>>> print os.environ.get('XILINX')
/Xilinx

Any thoughts on why it is behaving this way?

Thanks,
John




More information about the Python-list mailing list