We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The _winreg module

(New in 2.0) This module provides a low-level interface to the Windows registry database. The interface directly mirrors the underlying Windows API.

Example: Using the _winreg module
# File: winreg-example-1.py

import _winreg

explorer = _winreg.OpenKey(

# list values owned by this registry key
    i = 0
    while 1:
        name, value, type = _winreg.EnumValue(explorer, i)
        print repr(name),
        i += 1
except WindowsError:

value, type = _winreg.QueryValueEx(explorer, "Logon User Name")

print "user is", repr(value)

$ python winreg-example-1.py
'Logon User Name' 'CleanShutdown' 'ShellState' 'Shutdown Setting'
'Reason Setting' 'FaultCount' 'FaultTime' 'IconUnderline' ...

user is u'Effbot'