<div dir="ltr">Hello folks, i am working with Python-2.5.2, fedora 9 sulphur <br><br>I wanna change the value of environment variable , so if i open bash and type<br><br><br>envvariable=value;export variable then this sets the envvariable equal to the value.Now i am writing a python script to set the value of this environment variable.<br>
<br>import optparse<br>import os<br><br>def new_callback(option, opt_str, value, parser):<br><br> os.putenv("envvariable",value)<br><br>if __name__ == '__main__':<br><br> p = optparse.OptionParser()<br>
<br> p.add_option('-H',action="callback",callback=new_callback,type ="string")<br><br> options, remainder = p.parse_args()<br><br><br>when i run the script python prog.h -H value<br><br>
<br>now this dosen't change the value of the variable which was set earlier .Please help me in fixing this issue.<br><br><br>Thanks in advance<br><br>Aditya<br></div>