environment variable issue

Diez B. Roggisch deets at nospam.web.de
Mon Sep 15 21:40:03 CEST 2008

Michel Leunen schrieb:
> Tim Chase a écrit :
>> Your HOSTNAME variable hasn't been exported to subshells.  You can 
>> check this by looking at the output of
>>   bash$ export -p
>> which will print all the variables that are exported.  I suspect 
>> you'll see $USER in the list, but not $HOSTNAME
> Actually HOSTNAME seems to be exported as well:
> $ export -p | grep HOSTNAME
> declare -x HOSTNAME="LinuxPC"
> I don't know what to think of this but it's the beginning of an 
> explanation.

Not on my machine, and *if* it is exported, python gets it.

deets at absinth:~$ export -p | grep HOSTNAME
deets at absinth:~$ export HOSTNAME
deets at absinth:~$ export -p | grep HOSTNAME
declare -x HOSTNAME="absinth"
deets at absinth:~$ python -c "import os; print os.environ.get('HOSTNAME')"
deets at absinth:~$


More information about the Python-list mailing list