classification
Title: Contradictory documentation for os.putenv and os.system
Type: Stage:
Components: Documentation Versions: Python 3.2, Python 3.1, Python 3.0, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, stutzbach (2)
Priority: Keywords

Created on 2009-10-14 15:09 by stutzbach, last changed 2009-10-14 15:58 by georg.brandl.

Messages (2)
msg93994 - (view) Author: Daniel Stutzbach (stutzbach) Date: 2009-10-14 15:09
The documentation for os.putenv states that "changes to the environment
affect subprocesses started with os.system(), popen() or fork() and
execv()" and "assignments to items in os.environ are automatically
translated into corresponding calls to putenv()".

However, the documentation for os.system() states "Changes to os.environ
... are not reflected in the environment of the executed command."

A simple test confirms that the os.putenv documentation is the correct one:

Python 2.6
>>> import os
>>> os.environ['foo'] = 'bar'
>>> os.system('echo $foo')
bar
0
>>>
msg94001 - (view) Author: Georg Brandl (georg.brandl) Date: 2009-10-14 15:58
Thanks, fixed in r75403.
History
Date User Action Args
2009-10-14 15:58:01georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg94001
2009-10-14 15:09:36stutzbachcreate