[python-win32] Hex/Dec problem with LCID
Koen Van Herck
koen_van_herck at yahoo.com
Fri Oct 10 08:53:51 EDT 2003
There seems to be some hex/dec confusion with the LCID of the type library.
In the registry, I have a type library stored at
\Typelib\{UUID}\1.5\409\win32
which, according to MSDN means the locale ID is 0x409 (English US)
(see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap2_89o9.asp)
However, when I run makepy.py, this number is interpreted as decimal 409 and
stored in a file named
UUIDx409x1x5.py
This file contains a line
LCID = 0x409
Which is correct. When trying to import the type library
(win32com.client.Dispatch), the code will look for a file
UUIDx1033x1x5.py
which of course doesn't exist and the import fails.
Changing selecttlb.py as shown below seems to fix the problem (at least for
my case).
(This was with Win2K, Python 2.2, win32all-158)
Regards,
Koen.
--selecttlb.py, line 103--
try:
lcid = int(lcid, 16) # KVH fix
except ValueError: # crap in the registry!
continue
# Only care about "{lcid}\win32" key - jump straight there.
try:
key4 = win32api.RegOpenKey(key3, "%x\win32" % (lcid,)) # KVH fix
except win32api.error:
continue
More information about the Python-win32
mailing list