Possibly a stupid question: Why can't I set an environment variable with this?
os.system('set foo=bar') # on windows
I'm aware of os.environ
, and that works for me. I'm just confused about why the former doesn't work.
Possibly a stupid question: Why can't I set an environment variable with this?
os.system('set foo=bar') # on windows
I'm aware of os.environ
, and that works for me. I'm just confused about why the former doesn't work.
See the discussion here -- export
and set
are both shell commands, and whether on Windows or Unix, they're still inevitably being addressed to a child process running the shell (be it bash, cmd.exe, whatever) and so bereft of any further action when that child process terminates (i.e., when os.system
returns to the caller).