Issue 8349: os.environ.get returns incorrect data (original) (raw)
I have a Windows 7 64 bit machine, which means it has a few different environment variables concerning the program files location: PROGRAMFILES=C:\Program Files (x86) ProgramFiles(x86)=C:\Program Files (x86)
Note that both env variables have "(x86)" at the end.
When I do an os.environ.get I get the following results:
Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32
import os print os.environ.get('ProgramFiles(x86)') C:\Program Files (x86) print os.environ.get('PROGRAMFILES') C:\Program Files print os.environ.get('ProgramFiles') C:\Program Files
Note the missing "(x86)" on the last two test cases.
I tried it on the 64-bit version of 2.5.4 as well:
Python 2.5.4 (r254:67916, Dec 23 2008, 15:19:34) [MSC v.1400 64 bit (AMD64)] on win32
import os print os.environ.get('ProgramFiles(x86)') C:\Program Files (x86) print os.environ.get('PROGRAMFILES') C:\Program Files print os.environ.get('ProgramFiles') C:\Program Files
Same result. So I tried the 32-bit version of 2.5.4:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
import os print os.environ.get('ProgramFiles(x86)') C:\Program Files (x86) print os.environ.get('PROGRAMFILES') C:\Program Files (x86) print os.environ.get('ProgramFiles') C:\Program Files (x86)
...which gave the correct strings...