Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > query python env

Reply
Thread Tools

query python env

 
 
David Bear
Guest
Posts: n/a
 
      01-14-2005
How does one query the python environment, ie pythonhome, pythonpath,
etc.

also, are there any HOWTO's on keeping multiple versions of python
happy?
 
Reply With Quote
 
 
 
 
Michael Hoffman
Guest
Posts: n/a
 
      01-14-2005
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
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      01-14-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@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
 
Reply With Quote
 
Scott David Daniels
Guest
Posts: n/a
 
      01-14-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Michael Hoffman
Guest
Posts: n/a
 
      01-15-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
#!/usr/bin/env python vs. #!/usr/bin/python Yves Dorfsman Python 27 05-10-2008 03:03 AM
ENV['LD_LIBRARY_PATH'] not changing env TDR Ruby 3 08-31-2007 06:01 PM
SAXException: Attribute "xmlns:env" was already specified for element "env:Envelope' Ankit Mehta Java 1 09-29-2006 09:24 PM
#!/usr/bin/python or #!/usr/bin/env python? John Salerno Python 30 08-10-2006 05:20 AM
why use #!/usr/bin/env python rather than #!python? Adriano Ferreira Python 9 12-03-2005 12:25 AM



Advertisments