I'm trying to modify the environment variables on a parent shell from within Python. What I've attempted so far hasn't worked:
~ $ export TESTING=test
~ $ echo $TESTING
test
~ $
~ $
~ $ python
Python 2.7.10 (default, Jun 1 2015, 18:05:38)
[GCC 4.9.2] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['TESTING']
'test'
>>> os.environ['TESTING'] = 'changed'
>>> os.environ['TESTING']
'changed'
>>> quit()
~ $
~ $
~ $ echo $TESTING
test
That's all I've been able to come up with. Can it be done? How do I set environment variables of parent shell in Python?