newbie: Windows os.getenv(...
Pettersen, Bjorn S
BjornPettersen at fairisaac.com
Mon Oct 20 07:47:00 EDT 2003
> From: Martin [mailto:info12 at webmail.link-m.de]
>
> Hi there,
>
> i´d like to use environment variables within an python script.
> I can read with
> >>>t1 = os.getenv("temp")
> but not
> >>>d1 = os.getenv("%date%")
date doesn't seem to be an environment variable (check output of the 'set' command in a dos window or hit Windows+break -> Advanced -> environment variables in a recent version of windows). The fact that 'echo %date%' gives a result is "interesting"...
> Also I cannot change environment variables with
> os.putenv("any" , "something")
try
os.environ['any'] = 'something'
hth,
-- bjorn
More information about the Python-list
mailing list