![]() | Ned Batchelder : Blog | Code | Text | Site Python registry grepper » Home : Blog : October 2008 |
Python registry grepperThursday 2 October 2008 In writing the python registry switcher, I needed to search the registry for references to my old Python version. Another good use for a Python script: """ Search the Windows registry. Most of this is a pythonic wrapper around the _winreg module, with a few simple functions at the end to actually search the registry. | |
Comments
Thanks - this is really useful.
A couple of comments:
1. Your grep_registry function is weird. It expects sys.argv as an argument and this isn't intuitive for general-purpose use. It's better to make it expect just a list of search items
2. Whenever I'm dealing with the registry, Regscanner is very helpful. Hope you know about it.
Yes, you are right: I shouldn't pass sys.argv to grep_registry, I think I changed it back and forth too much, and didn't notice I'd left it in a strange state....
In RegKey.__str__(), do you really mean to display the hexadecimal value of self.root if it is unknown?
I did intend to display the root as hex if unknown. Granted, this is an odd case, since I only ever use known roots. But the registry constants for the hives are specialized integers that are best displayed in hex. Did I miss something?
Add a comment: