Using environ from os package dose not
work well when unsetting the variables. So write the unix commands in
a korne shell script file and run it from python solves the issue.
import os command = "unset TEST " + "\n" \ "export GLOBAL_VALUE='global_value'" + "\n" \ "sample\n" scr_name = "temp.tmp" scr_file = open(scr_name, 'w') #write everything to a scr_file.write(command) scr_file.close() os.chmod(scr_name, 0744) # mode -rwxr--r-- status = os.system(scr_name) os.remove(scr_name)
This is an amazing blog. Keep it up. python training in Chennai