bug in Makepy

Jim jim at trainplayer.com
Thu Jun 22 06:35:02 EDT 2006


I was trying to use Makepy to wrap a typelib, but couldn't find the one
I wanted in the list of libs offered, and couldn't find a way to browse
to a specific one.

Turns out the reason was that the lib was version 10, which was listed
in the registry in hex as version a.0.  The tlb chooser in Makepy
rejects hex values. The author was evidently aware of this, since there
is a comment in the code about it.

Here is a fix -- add 4 lines in
site-packages\win32com\client\selecttlb.py:

try:
	# For some reason, this code used to assume the values were hex.
	# This seems to not be true - particularly for CDO 1.21
	# *sigh* - it appears there are no rules here at all, so when we need
	# to know the info, we must load the tlb by filename and request it.
	# The Resolve() method on the TypelibSpec does this.
	major = int(major_minor[0])
	minor = int(major_minor[1])
except ValueError: # try again in case values are in hex
=>	try:
=>		major = int(major_minor[0], 16)
=>		minor = int(major_minor[1], 16)
=>	except ValueError: # crap in the registry!
		continue

Hope this helps someone.

  -- Jim




More information about the Python-list mailing list