Problem using os.environ.get
jr244 at kent.ac.uk
Wed Nov 14 17:21:53 CET 2007
paragon.john at gmail.com wrote:
> # echo $HOSTTYPE
> # python
>>>> import os
>>>> print os.environ.get('HOSTTYPE')
> If I do the same thing with a different variable (XILINX, in this
> case), it works fine.
bash documentation indicates that HOSTTYPE (and a few others: OSTYPE,
MACHTYPE, etc.) are variables set by the shell - not quite part of the
environment, as such, and they're don't seem to be available to any
subprocess: if you launch ksh from bash and check the variable, you'll
get none too (on netbsd at least).
So, that's a bash problem - not that it helps I guess :-) but bash docs
may have some more info about this issue.
More information about the Python-list