[python-win32] Setting environment variables in windows from Python Programs
p.f.moore at gmail.com
Tue May 10 10:38:24 CEST 2005
On 5/10/05, Nalli Dinesh <nalli.dinesh at gmail.com> wrote:
> This seems very easy, as every programming language provides this. But
> I don;t know why I have this not working for me in Python scripts.
> The problem:
> I am trying to create and set environment variable LANG under windows
> from Python file. I am using OS module's putenv or environ to do so.
> But it is not really creating the environment variable or neither set
> the same from the code.
> This seems to be a easy fix, if anyone has a reason and fix for this
> problem, please shoot it back to me. I am using python2.4
No program, in any language, can set an environment variable which
will affect the shell from which that program was launched. The only
- batch files, which are interpreted by the shell itself
- languages with some form of intimate relationship with the shell
(some shells have this relationship with the REXX language)
- Windows API calls to set the global environment, and then notify
running shells to pick up the changes
I'm assuming you don't mean the third option (and I don't know the
details of the calls required, if you do).
Perhaps you can give an example of what you want to do (using another
language, as you can't get it to work in Python)? But if I have
understood your description correctly, I'm afraid it isn't "very
More information about the Python-win32