win32com typelib difficulty

Discussion in 'Python' started by Paul McGuire, May 24, 2004.

  1. Paul McGuire

    Paul McGuire Guest

    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.
    >>> import win32com.client
    >>> xyz = win32com.client.Dispatch("XYZApp")

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 95,
    in Dispatch
    dispatch, userName =
    dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
    File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 84,
    in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
    File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 72,
    in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
    pythoncom.IID_IDispatch)
    pywintypes.com_error: (-2147467262, 'No such interface supported', None,
    None)
    >>> xyz = win32com.client.Dispatch("XYZ")
    >>> xyz

    <COMObject XYZ>
    >>> xyz._print_details_()

    AxDispatch container XYZ
    Methods:
    Props:
    Get Props:
    Put Props:
    >>>



    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\lib\site-packages\win32com\client\dynamic.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
     
    Paul McGuire, May 24, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    297
  2. Alexander Eisenhuth

    Howto access a enumeration in a COM TypeLib

    Alexander Eisenhuth, Jun 21, 2005, in forum: Python
    Replies:
    2
    Views:
    473
    Alexander Eisenhuth
    Jun 21, 2005
  3. Vince C.
    Replies:
    12
    Views:
    274
    Vince C.
    Jan 15, 2004
  4. Thomas Born
    Replies:
    1
    Views:
    176
    Thomas Born
    Feb 9, 2004
  5. Peter X
    Replies:
    3
    Views:
    370
    Ray at
    Apr 8, 2004
Loading...

Share This Page