As you can see on the picture below, I have 'SPARK_HOME' environment variable:
However I just can't get it through python:
import os
os.environ.get('SPARK_HOME', None) # returns None
"SPARK_HOME" in os.environ # returns False
What am I doing wrong? Operating system is Windows 7 PS: I can get other variables, for example:
spark_home = os.environ.get('PYTHONPATH', None)
print spark_home # returns correct path

WM_SETTINGCHANGEmessage to top-level windows. Explorer see this message and reloads its environment from the registry values; it's pretty much the only program that looks for this message. Console programs generally don't even own any windows. You need to start a new instance of cmd.exe or python.exe with Explorer as the parent, so it will inherit the updated environment.WM_SETTINGCHANGEand updates also its own environment variable list which contains also some Total Command related environment variables. That can be seen on startingcmd.exefrom within Total Commander and runset. Then a user or system environment variable is added/modified using Windows System Control Panel and after closing Environment Variables dialog window with button OK, one morecmd.exeis started from within Total Commander andsetis executed also in this second command process instance. The added/modified variable is shown in second cmd.