query python env

Steve Holden steve at holdenweb.com
Fri Jan 14 17:14:28 EST 2005


Michael Hoffman wrote:

> David Bear wrote:
> 
>> How does one query the python environment, ie pythonhome
> 
> 
> sys.prefix
> 
>  > pythonpath
> 
> sys.path
> 
>> etc.
> 
> 
[...]
I suspect rather that the OP is looking for os.environ, as in:

[sholden at headrat sholden]$ ENVAR=value
[sholden at headrat sholden]$ export ENVAR
[sholden at headrat sholden]$ python
Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
[GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.environ["ENVAR"]
'value'


regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list