473,394 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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?
Jul 18 '05 #1
4 1751
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
Jul 18 '05 #2
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
Sc***********@Acm.Org
Jul 18 '05 #3
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
Jul 18 '05 #4
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
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sheila King | last post by:
I have searched for an answer to this question on the comp.lang.python archives at Google Groups, and also looked through the (sparse) MySQLdb documentation, and cannot confirm for a FACT what I...
2
by: sumi | last post by:
I am very new to python , I have small query could some one help me. every time I get a new load i need to do few things like creating some dir, changing some file contents and moving some files ,...
3
by: krystoffff | last post by:
Hi I would like to paginate the results of a query on several pages. So I use a query with a limit X offset Y to display X results on a page, ok. But for the first page, I need to run the...
7
by: Bernard Lebel | last post by:
Hello, I'm stumbled at a serious problem, and quite frankly getting desparate. This is a rather long-winded one so I'll try to get straight to the point. I have this Python program, that...
6
by: Caleb Hattingh | last post by:
Hi everyone I suspect this has come up before, but google and group searches for "python package index query" or "pypi query" and the like haven't turned anything up. I want to monitor the...
4
by: Per | last post by:
I am doing a Natural Language processing project for academic use, I think google's rich retrieval information and query-segment might be of help, I downloaded google api, but there is query...
1
by: artistlikeu | last post by:
dear all i am using postgresql data base.... is it possible to write a subquery in inside the main query in python program.... for example something like this..... courses = db.query("select...
17
by: erikcw | last post by:
Hi all, I'm trying to run the following query: amember_db = MySQLdb.connect(host="localhost", user="**********", passwd="*****", db="*******") # create a cursor self.amember_cursor =...
6
by: ApoorvaDesai | last post by:
just for info I am using BOA constructor and python 2.3 I am writting a query which works if i break it up as follows (and it also works if I run it in SQL view of access) stn_name = whatever...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.