Environment variables in Windows 2000

Greg Krohn volucris at hotmail.com
Tue Nov 20 00:49:16 EST 2001


"Greg Krohn" <volucris at hotmail.com> wrote in message
news:3bf9ec62$0$79563$6e49188b at news.goldengate.net...
> "Brian Geddes" <brian.j.geddes at intel.com> wrote in message
> news:9tcobh$qql at news.or.intel.com...
> > All -
> >
> > I've been trying to store/pass information in environment variables in
> > Windows 2000, but things aren't working the way I expect them to.  The
> docs
> > state that by making changes to the os.system dictionary, the changes
> should
> > be carried over in environment space automatically by os.putenv().
> However,
> > the following which looks like it should work, does not:
> >
> > import os
> > import sys
> > os.system["HELLO"] = "Testing"
> > sys.exit()
> >
> > # Run Python again
> > import os
> > print os.system["HELLO"]
>
> Mmm...there's something goofy with that. Are you sure that first one
works?
> Did you assign something to os.system itself? Try type(os.system). It
should
> be a function, not a dictionary.
>
> [Python 2.1.1]
>
> >>> import os
> >>> type(os.system)
> <type 'builtin_function_or_method'>
> >>> print os.system.__doc__
> system(command) -> exit_status
> Execute the command (a string) in a subshell.

I think you're looking for os.getenv() and os.putenv().

greg





More information about the Python-list mailing list