Problem using os.environ.get

J. Robertson jr244 at kent.ac.uk
Wed Nov 14 11:21:53 EST 2007


paragon.john at gmail.com wrote:
> 
 >
> # 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.

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.

j.



More information about the Python-list mailing list