Environment variables in Windows 2000

Greg Krohn volucris at hotmail.com
Tue Nov 20 00:44:19 EST 2001


"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.





More information about the Python-list mailing list