os.putenv() has no effect

Skip Montanaro skip at pobox.com
Tue Jun 18 14:22:48 EDT 2013


> Does anybody know why this would happen or what I could be doing wrong?

os.putenv will only affect the environment in subprocesses.  Consider
this session fragment:

% python
Python 2.7.2 (default, Oct 17 2012, 03:11:33)
[GCC 4.4.6 [TWW]] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.putenv("PATH", "/tmp")
>>> os.system("/usr/bin/env")
...
PATH=/tmp
...

Skip



More information about the Python-list mailing list