Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   query python env (http://www.velocityreviews.com/forums/t340306-query-python-env.html)

David Bear 01-14-2005 01:26 AM

query python env
 
How does one query the python environment, ie pythonhome, pythonpath,
etc.

also, are there any HOWTO's on keeping multiple versions of python
happy?

Michael Hoffman 01-14-2005 11:03 AM

Re: query python env
 
David Bear wrote:
> How does one query the python environment, ie pythonhome


sys.prefix

> pythonpath


sys.path

> etc.


sys.etc

> also, are there any HOWTO's on keeping multiple versions of python
> happy?


I think it is sufficiently trivial that none is needed. Just make sure
the distributions are installed in different directories.

What problems are you having?
--
Michael Hoffman

Steve Holden 01-14-2005 10:14 PM

Re: query python env
 
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@headrat sholden]$ ENVAR=value
[sholden@headrat sholden]$ export ENVAR
[sholden@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

Scott David Daniels 01-14-2005 10:18 PM

Re: query python env
 
David Bear wrote:
> How does one query the python environment, ie pythonhome, pythonpath,
> etc.
>
> also, are there any HOWTO's on keeping multiple versions of python
> happy?


In general, (and in this case) the answer is system-specific.
You need to explain (A) what operating system, and (B) what you
mean by multiple Python versions.

For example, for Windows 2K/XP, As long as you try for only
distinct major versions (2.2.x, 2.3.x, 2.4.x). There should
not be a problem. The primary issues are where (and how) does
your system get to the python files.


--Scott David Daniels
Scott.Daniels@Acm.Org

Michael Hoffman 01-15-2005 01:37 AM

Re: query python env
 
Steve Holden wrote:
> I suspect rather that the OP is looking for os.environ, as in:


He was using the examples of PYTHONHOME and PYTHONPATH which have
specific meanings. Using sys.prefix is better than
os.environ["PYTHONHOME"], which is unlikely to be set.
--
Michael Hoffman


All times are GMT. The time now is 04:35 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.