[python-win32] LOCALE related stuff Re: Setting environment

Andrew MacIntyre Andrew.MacIntyre at aba.gov.au
Thu May 12 02:56:44 CEST 2005


> From: Nalli Dinesh
> 
> I really don;t think so. I looked at process mamangement in 
> python. By default child process inherits all the environment 
> variables from parent process. In case if a python 
> application uses popen3 to run a command in a 
> subprocess(child) then, before that whatever Environment 
> variables u create or set in the code are passed on to the 
> sub process and the sub process setlocale is picking up the 
> LANG environment variable defined in the parent process.
> 
> But the problem remains, if a process sets environment 
> variable from the code, and other part of code which uses 
> setlocale need be able to see this environment variable. 
> Which is not happening. But if I print the environment 
> variable in the other parts of the code, they all printing 
> that the environmental variable is set.

My reply did not make this clear, but the behaviour of the locale 
code in the two runtimes is what I was alluding to.

I wouldn't mind betting that MSVC 7.1's C library initialises the 
locale at process initialisation, whereas MSVC 6's C library defers 
locale initialisation until the first call.

If the former is true, subsequently setting the environment variable 
is a complete waste of time because its far too late.

----------------------------------------------------------------------
Andrew MacIntyre                  \ email: andrew.macintyre at aba.gov.au
Planning Branch                    \ tel:  +61 2 6256 2812
Australian Broadcasting Authority   \ fax: +61 2 6253 3277
-> "These thoughts are mine alone!" <---------------------------------


More information about the Python-win32 mailing list