Casey Bralla on 24 Dec 2010 05:04:31 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Get Python Environmental Varibles

On Friday 24 December 2010 7:56:39 am Chris Nehren wrote:
> On Dec 24, 2010, at 7:52 AM, Casey Bralla wrote:
> > I'm working on a cgi-bin script in Python, and I'd like to be able to
> > read environmental variables.  There is a nifty routine for this in
> > python call os.getenv.  The only problem is that you have to know what
> > the environmental name is, before you can get it's value.
> > 
> > I'd like to read the entire list of variables, and then use that to
> > decide which one will have the utility I need (I'm looking for some path
> > info, but also want to understand the whole system.)
> > 
> > Does anybody know how to get a complete list of environmental variables
> > from a running python program?
> Have you looked at the os.environ dictionary? A quick Google search found
> it.

Yes, I've read the entire section in the Python docs.  It goes into great 
detail, but doesn't answer my question.  How do I get a List of all variables?  
If I know the name of the variable, I can find it without any trouble.  
Unfortunately, I don't know the names.  <sigh>

Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --