ANN: winreg module (_winreg wrapper)

Ollie Rutherfurd oliver at rutherfurd.net
Tue Jul 24 18:17:00 CEST 2001


Hello,

I've written an object-oriented wrapper for _winreg.  It's a little higher
level than _winreg, and it allows you to access the sub keys and values of a
key, via a key object.

I remember seeing a similar post a while back, but as I couldn't find the post
or the module...  Anyway, I'm learning Python, and this seemed like a good
little project.

Here's a little code snippet showing how it can be used:

>>> from winreg import *
>>> key = Key(HKCR)
>>> len(key.keys)
3940
>>> print key[0].name
*
>>> '.py' in key.keys
1
>>> print key['.py'].values[None]
Python.File
>>> pyfile = key['Python.File']
>>> print pyfile['Shell\\Open\\Command'].values[None]
"C:\\Python21\\python.exe" %1" %*
>>>

There's not really any external documentation, but I used DocTest (which is
really cool!), so there are a bunch of usage examples in the code.

You can find winreg here:

http://www.newtonsplace.net/winreg.html

If you check it out, I'd love feedback!

-Ollie Rutherfurd
oliver at rutherfurd.net





More information about the Python-list mailing list