win32com typelib difficulty

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

    win32com typelib difficulty

    Software versions:
    Python - 2.3.3
    win32all extensions - build 163
    OS- Win2000 SP4

    I am having trouble in accessing a customer's proprietary COM type library.
    After running makepy against the customer's typelib, I am still unable to
    create a typed object, getting the following Python traceback (I have to
    sanitize the customer's product, I have replaced it with XYZ):

    Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
    win32
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import win32com.client
    >>> xyz = win32com.client .Dispatch("XYZA pp")[/color][/color][/color]
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "C:\Python23\li b\site-packages\win32c om\client\__ini t__.py", line 95,
    in Dispatch
    dispatch, userName =
    dynamic._GetGoo dDispatchAndUse rName(dispatch, userName,clsctx )
    File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line 84,
    in _GetGoodDispatc hAndUserName
    return (_GetGoodDispat ch(IDispatch, clsctx), userName)
    File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line 72,
    in _GetGoodDispatc h
    IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
    pythoncom.IID_I Dispatch)
    pywintypes.com_ error: (-2147467262, 'No such interface supported', None,
    None)[color=blue][color=green][color=darkred]
    >>> xyz = win32com.client .Dispatch("XYZ" )
    >>> xyz[/color][/color][/color]
    <COMObject XYZ>[color=blue][color=green][color=darkred]
    >>> xyz._print_deta ils_()[/color][/color][/color]
    AxDispatch container XYZ
    Methods:
    Props:
    Get Props:
    Put Props:[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]


    If xyz is a <COMObject XYZ>, how do I invoke methods on it? I've already
    tried the straightforward xyz.method1() call, and in this case I get:

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line 477,
    in __getattr__
    raise AttributeError, "%s.%s" % (self._username _, attr)
    AttributeError: XYZ.method1

    although I know that method1() is defined for this interface.


    Any other suggestions on how to proceed with this TLB? I *really* want to
    be able to write test scripts in Python, not in VB.

    -- Paul




Working...