Working with environment variables.

aditya shukla adityashukla1983 at
Thu Sep 11 02:39:53 CEST 2008

Hello folks, i am working with Python-2.5.2, fedora 9 sulphur

I wanna change the value of environment variable , so if i open bash and

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.

import optparse
import os

def new_callback(option, opt_str, value, parser):


if __name__ == '__main__':

     p = optparse.OptionParser()


     options, remainder = p.parse_args()

when i run the script python prog.h -H value

now this dosen't change the value of the  variable which was set earlier
.Please help me in fixing this issue.

Thanks in advance

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list