[Python-au] Environment vars

Grant McDonald gmcdonald at infocomp.com
Thu Aug 18 01:40:21 CEST 2005


Not entirely sure,
 
The docs say you should modify os.environ directly since it automatically
calls putenv, but as you stated on WinXP and as you say it doesn't seem to
work.  I guess putenv may not be supported on WinXP.
 
If you want a reliable way of modifying the environment on WinXP use the
registry (unfortunately platform specific):
 
System environment ->
 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment
 
User environment ->
 
HKEY_CURRENT_USER\Environment
 
 
Regards,
 
Grant McDonald
 
 

-----Original Message-----
From: python-au-bounces at python.net [mailto:python-au-bounces at python.net]On
Behalf Of Mike Dewhirst
Sent: 17 August 2005 21:28
To: python-au at python.net
Subject: [Python-au] Environment vars


I'm having difficulty inserting a couple of vars into the environment from
within a script. 

os.putenv(varname, value) doesn't seem do it.

The code doesn't barf but (in Windows XP) the set command doesn't indicate
it actually happened. I haven't tried it with Linux.

Is there a trick to it?

TIA

Mike


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://starship.python.net/pipermail/python-au/attachments/20050818/a5a551eb/attachment.htm


More information about the python-au mailing list