[Python-Dev] Registry keys written by x64 installer

Mark Hammond mhammond at skippinet.com.au
Fri Jul 13 03:03:38 CEST 2007

After installing the x64 version of Python 2.5.1 via the MSI file on
python.org, I noticed most of the registry keys are "missing".  Further
investigation shows they aren't actually missing, but have simply been
"virtualized", so they actually appear under the Wow6432Node key.

This Wow6432Node key is used by 32bit programs running on a 64bit OS.
Ironically, this means that a 32 bit Python can open HKLM\Software\Python -
the OS virtualizes that request to the Wow3264Node tree.  However, a 64 bit
Python (ie, the very Python that was installed by the MSI) fails to open
that key - no vistualization occurs and as the key specified does not exist,
we fail.  For example:

This is the Python 2.5 installed by the MSI installer:

Python 2.5.1 (r251:54863, Apr 18 2007, 09:02:36) [MSC v.1400 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _winreg
>>> _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 2] The system cannot find the file specified

But if I use a 32bit version of Python:

Python 2.5.1 (release25-maint, Jun  4 2007, 23:00:11) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _winreg
>>> _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
<PyHKEY at 004790B0 (00000098)>

It works.

I'm afraid my knowledge of MSI is very limited, so I'm not sure where to
start.  One thing I did notice is that msilib\__init__.py has a variable
'Win64' set, hard-coded to 0 - but I've no idea if it is relevant.
Presumably it is relevant to *something*, otherwise it would not have been
created - but its unclear when and how this should be set to 1, and if this
should concern people trying to use bdist_msi to create x64 extension
packages - but for now, let's just stick with the topic at hand - the
registry keys set by the installer.

Any clues?



More information about the Python-Dev mailing list