result of merging in the pythonpath setting after the current directory changing shell variables like normal dictionariesthe os environ object supports both key indexing and assignment as for dictionariesassignments change the value of the keyos environ['temp'' :\\users\\mark\\appdata\\local\\temp os environ['temp' ' :\tempos environ['temp'' :\\tempbut something extra happens here in all recent python releasesvalues assigned to os environ keys in this fashion are automatically exported to other parts of the application that iskey assignments change both the os environ object in the python program as well as the associated variable in the enclosing shell environment of the running program' process its new value becomes visible to the python programall linked-in modulesand any programs spawned by the python process internallykey assignments to os environ call os putenv-- function that changes the shell variable outside the boundaries of the python interpreter to demonstrate how this workswe need couple of scripts that set and fetch shell variablesthe first is shown in example - example - pp \system\environment\setenv py import os print('setenv 'end='print(os environ['user']show current shell variable value os environ['user''brianos system('python echoenv py'runs os putenv behind the scenes os environ['user''arthuros system('python echoenv py'changes passed to spawned programs and linked-in library modules os environ['user'input('?'print(os popen('python echoenv py'read()this setenv py script simply changes shell variableuserand spawns another script that echoes this variable' valueas shown in example - example - pp \system\environment\echoenv py import os print('echoenv 'end='print('hello,'os environ['user']shell environment variables