update environment-vars (win32api)

robert_kuzelj at my-deja.com robert_kuzelj at my-deja.com
Mon May 29 13:42:54 CEST 2000


im trying to set some environment vars in the registry.
which actually is working fine with the win32api-module.

but what bothers me (even so this is no python-problem) is the
fact that if i open a dos-box (winNT4.0sp5) and try to get
the new defined values it seems not to exist.

only after i open up the system-dialog and there the environment-tab
(where i do see the new vars) and i click on set and ok, then the
vars appear in the dos-box too.

does anybody knows a workaround?

ciao robertj

>>> key = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
       "SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
       0, win32con.KEY_ALL_ACCESS)
>>> print win32api.RegQueryValueEx(key, "CLASSPATH")
('.;%CP_JDK%;%CP_JPYTHON%;%CP_OLEBRIDGE%;%CP_DOCWIZ%;', 2)
>>> win32api.RegSetValueEx(key, "CP_BBB", 0, win32con.REG_SZ, "BBB")
>>> print win32api.RegQueryValueEx(key, "CP_BBB")
('BBB', 1)


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list