Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#379 Some typelibs have non integer versions

open-invalid
Mark Hammond
com (105)
5
2012-02-11
2008-08-21
Mark Hammond
No

From python-win32:
"""
When using the makepy utility I noticed it used to crash out with the following traceback:

line 148, in SelectTlb
i.major = int(i.major, 16)
ValueError: invalid literal for int() with base 16: 'CS2'
...
Most likely this (last line of traceback) refers to the version number of Adobe Photoshop Creative Suite 2.
"""
There is some existing confusion between hex and int in that file, but it doesn't expect strings! Note that GetTypeLibInfo() etc all use integers for the version info - which probably means the typelib can't be directly loaded - but that isn't really our problem - we shouldn't die.

Discussion

  • Mark Hammond
    Mark Hammond
    2012-01-28

    • status: open --> closed-invalid
     
  • Mark Hammond
    Mark Hammond
    2012-01-28

    I'm rejecting this as it seems limited to just the original typelib and hasn't since been reported again.

     
  • Brenda Trist
    Brenda Trist
    2012-02-09

    I am having the same issue as the person who brought this up a few years ago. I noticed it was closed recently with no resolution. You mention in your comments that it has to do with the original typelib. My question is why would Python2.5 have no problem but Python2.6 and up does. I would like to upgrade because the nitro-nitf has been compiled with Python2.6 but yet I still need to be able to run COM Makepy Utility to obtain the Excel and Word libraries of wincom32. Is there anything I can do to work around this problem. Thank you.

     
  • Mark Hammond
    Mark Hammond
    2012-02-09

    • status: closed-invalid --> pending-invalid
     
  • Mark Hammond
    Mark Hammond
    2012-02-09

    > My question is why would Python2.5 have no problem but Python2.6 and up does.

    Are you sure it is the same problem? The original problem is that pywin32 assumes a typelib version is an integer, but in some cases it is a string that can't be converted to an integer. Also, the original problem must have been pre 2.6 as 2.6 wasn't out then. Therefore, I'd be really surprised if this is the same issue you are facing. Can you give a few more details?

     
  • Brenda Trist
    Brenda Trist
    2012-02-10

    When I run COM Makepy utility from PythonWin (version 2.6.7) I get the following message which I did not get when I was using PythonWin 2.5.

    Failed to execute command:
    from win32com.client import makepy;makepy.main()
    Traceback (most recent call last):
    File "C:\Python26\Lib\site-packages\pythonwin\pywin\framework\toolmenu.py", line 103, in HandleToolCommand
    exec "%s\n" % pyCmd
    File "<string>", line 1, in <module>
    File "C:\Python26\lib\site-packages\win32com\client\makepy.py", line 362, in main
    rc = selecttlb.SelectTlb()
    File "C:\Python26\lib\site-packages\win32com\client\selecttlb.py", line 150, in SelectTlb
    i.major = int(i.major, 16)
    ValueError: invalid literal for int() with base 16: 'CS2'

    I got this same message when I tried to upgrade to Python2.7. Gave up and went back to Python 2.5. Now I really need to upgrade because the nitro-nitf I am trying to use was compiled with Python2.6. There is a good chance that I do not have something set up correctly I am just unsure where to look.

    Thank you.

     
  • Mark Hammond
    Mark Hammond
    2012-02-11

    • status: pending-invalid --> open-invalid
     
  • Mark Hammond
    Mark Hammond
    2012-02-11

    So yeah, you do have the same root problem, but I suspect it would also happen in Python 2.5. Are you sure you tried to generate a makepy stub in Python 2.5? It may be that you can use the COM object without a makepy stub.

     
  • Brenda Trist
    Brenda Trist
    2012-02-12

    I know I have run COM Makepy Utility before because it is in my installation notes for installing/upgrading Python onto my system. I have been using Python since version 2. COM Makepy Utility was inserted as one of my procedures when I started using win32com in order to edit WORD and EXCEL documents. Which is when I upgrade from 2.3 to 2.5 a few years ago. So it has been awhile since an upgrade at my end. When I was using Python2.5 I was also using pywin32-210.win32-py2.5. With Python2.6 I am trying to use pywin32-216.win32-py2.6. Found pywin32-210.win32-py2.6.exe. Downloaded and installed. That other error went away. so I can at least build the COM Makepy Utility it seems. So there is something with 216 build of pywin32. So far I only receive a warning when I run COM Makepy Utility

    PythonWin 2.6.7 (r267:88850, Jun 27 2011, 13:56:33) [MSC v.1500 32 bit (Intel)] on win32.
    Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for further copyright information.
    >>> C:\Python26\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py:87: DeprecationWarning: catching of string exceptions is deprecated
    except (win32ui.error, AttributeError):

    Hope this sheds some light.
    Thank you