Using os
module I can get the values of the environment variables. For example:
os.environ['HOME']
However, I cannot set the environment variables:
os.environ['BLA'] = "FOO"
It works in the current session of the program but when I python program is finished, I do not see that it changed (or set) values of the environment variables. Is there a way to do it from Python?
If what you want is to make your environment variables persist accross sessions, you could
For unix
do what we do when in
bash
shell. Append you environment variables inside the~/.bashrc
.or for Windows:
in a
*.bat
that is in Startup in Program FilesI am not sure. You can return the variable and set it that way. To do this print it.
(python program)
(bash)