How to use os.putenv() ?

google at tyeon.com google at tyeon.com
Wed Aug 29 21:21:11 EDT 2007


>>>
>>> import os
>>>
>>> os.environ['PATH']
'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
\system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>>>
>>> os.putenv('PATH', 'C:\\WINNT\\system32')
>>>
>>> os.environ['PATH']
'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
\system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>>>

What am I doing wrong?  How do I change the value of an environment
variable?




More information about the Python-list mailing list