bug in Makepy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim

    #1

    bug in Makepy

    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\win32c om\client\selec ttlb.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

  • Jim

    #2
    Re: bug in Makepy

    > This only works if the hexadecimal representation has digits in [A-F].[color=blue]
    > What if the stored value is 10, but in hexadecimal?[/color]

    I don't get what you mean. If the value is "10, but in hexadecimal",
    isn't that A?

    The problem my fix solves is where the folder under the typelib guid is
    named something like "a.0." It does what I need. If you see a case it
    doesn't handle, maybe you could propose a better fix?

    -- Jim

    Comment

    • Jim

      #3
      Re: bug in Makepy

      > Always interpret it as hex, or always interpret it as decimal.

      I see what you mean. But I don't think I'll worry about it.

      -- Jim

      Comment

      Working...