[pywin32-bugs] [ pywin32-Bugs-887212 ] Exception raised accessing REG_EXPAND_SZ type in registry
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2004-01-30 23:49:56
|
Bugs item #887212, was opened at 2004-01-29 19:43 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=887212&group_id=78018 Category: com Group: None Status: Open Resolution: None Priority: 5 Submitted By: Phil Rittenhouse (prittenh) Assigned to: Nobody/Anonymous (nobody) Summary: Exception raised accessing REG_EXPAND_SZ type in registry Initial Comment: I ran into two problems using Makepy and the COM Browser both caused by the same type library registry entry. This entry was of the type REG_EXPAND_SZ instead of the usual REG_SZ. When running the COM Browser and expanding the registered type libraries, I woud get the following exception: File "win32com\client\combrowse.py", line 498, in GetSubList name = win32api.RegQueryValue(subKey, versionStr) pywintypes.error: (13, 'RegQueryValue', 'The data is invalid.') win32ui: Exception in OnNotify() handler When running Makepy, I got the following: File "win32com\client\selecttlb.py", line 122, in EnumTlbs spec.ver_desc = tlbdesc + " (" + version + ")" TypeError: unsupported operand types for +: 'NoneType' and 'str' In both cases I traced the source of the error to a call to win32api.RegQueryValue(). From what I can tell, this function does not handle the REG_EXPAND_SZ type. The documentation for this function, that I found on ActiveState, says that this function should be avoided, and win32api.RegQueryValueEx() should be used instead. So, in combrowse.py I replaced name = win32api.RegQueryValue(subKey, versionStr) with: subSubKey = win32api.RegOpenKey(subKey, versionStr) name = win32api.RegQueryValueEx(subSubKey, '')[0] And in selecttlp.py, EnumKeys() I replaced val = win32api.RegQueryValue(root, item) to: subKey = win32api.RegOpenKey(root, item) val = win32api.RegQueryValueEx(subKey, '')[0] This seems to work, but I am completely new to this API, so I make no guarantees. It looks like there are many other places that use RegQueryValue(), so they may need to be changed aswell. I am running Python 2.2.3, with win32all build 162, on windows XP. The registry entry that caused the problem was for the LDMView ActiveX Control module. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=887212&group_id=78018 |