How do I assign a runtime variable value to an environment variable in python? Below is the code, I need to assign dynamic value of variable "exce" to environment variable "result"
Here is my snippet for the part :
try:
logging.info("Process successfull")
except Exception as exce: # pylint: disable=broad-except
logging.error("Process Failed")
logging.error(exce)
with open(os.path.expanduser("~/.bashrc"), "a") as outfile:
result = "export MYVAR=exce"
outfile.write(result)