windows registry

Mark Hammond mhammond at
Thu Apr 13 23:09:49 EDT 2000

Note that in Python 1.6, there is a "winreg" standard module - ie, no need
for the win32 extensions.

This is taken from the win32api sources.  The relevant differences are:

* The module name has obviously changed!  The winreg module will raise
winreg.error (which happens to be thenew standard WindowsError exception
object, derived from OSError, derived from EnvironmentError, derived from
StandardError - so any of these error objects will catch the exceptions!)

* The function names have changed (eg, win32api.RegCreateKey ->

* Security information is not supported - none must be passed to all
winreg functions that accept security information.

* winreg has docstrings, win32api has help files :-)

Apart from that, all args and usage are identical to the win32api
functions.  Thus, in the general case, code can be changed to use winreg
from win32api with a couple of search-and-replaces!


More information about the Python-list mailing list