regarding value types: http://docs.python.org/2/library/_winreg.html#value-types
how query _winreg.reg_binary
'reg_binary'
?
i can manually with:
import _winreg reg_type_str = { _winreg.reg_binary: 'reg_binary', _winreg.reg_dword: 'reg_dword', _winreg.reg_dword_little_endian: 'reg_dword_little_endian', _winreg.reg_dword_big_endian: 'reg_dword_big_endian', _winreg.reg_expand_sz: 'reg_expand_sz', _winreg.reg_link: 'reg_link', _winreg.reg_multi_sz: 'reg_multi_sz', _winreg.reg_none: 'reg_none', _winreg.reg_resource_list: 'reg_resource_list', _winreg.reg_full_resource_descriptor: 'reg_full_resource_descriptor', _winreg.reg_resource_requirements_list: 'reg_resource_requirements_list', _winreg.reg_sz: 'reg_sz', } reg_type_str.get(_winreg.reg_sz)
surely there's better way?
what i'm trying ...
example query:
reg_data, reg_type = _winreg.queryvalueex(key, reg_value) log.debug("query: %s [%d:%s]" % (reg_data, reg_type, reg_type_str.get(reg_type)))
i'm thinking should able this:
>>> k, v in _winreg.__dict__: ... if v == _winreg.reg_sz: ... print k traceback (most recent call last): file "<pyshell#468>", line 1, in <module> k, v in _winreg.__dict__: valueerror: many values unpack
of course, doesn't work, if did method cause issues when used _winreg:
>>> v in _winreg.__dict__.itervalues(): ... if v == _winreg.reg_sz: ... print v 1 1 1 1 1 1
i've come conclusion need using manual method supplied in original question.
the way around if _winreg developers supply function us.
Comments
Post a Comment