Pythonwin and makepy problems
Stefan Schukat
SSchukat at dspace.de
Tue May 21 04:18:22 EDT 2002
Hi,
your object probably does not support the runtime extraction of the CLSID.
Without this information the late bound wrapper doesn't know what
kind of early bound wrapper to use. You can either give this information by
hand i.e.
# assuming import of the makepy wrapper is already done
from win32com.client import CLSIDToClass
import win32com
import pywintypes
MyLate = win32com.client.Dispatch(ProgID)
MyEarlyClass = CLSIDToClass.GetClass(str(pywintypes.IID(ProgID)))
MyEarly = MyEarlyClass(MyLate)
or if you rename [GUID].py to MyComObject.py just
import MyComObject
MyEarly = MyComObject.MyObject() # Name of the CoClass
Otherwise your dispatch implementation must support the GetTypeInfo function
and have a typelib either included or registered on the system.
Stefan
-----Original Message-----
From: Joseph Toman [mailto:toman at cyber-dyne.com]
Sent: Friday, May 17, 2002 4:52 PM
To: python-list at python.org
Subject: Pythonwin and makepy problems
How exactly does Pythonwin know how to tab complete an object in the
interpreter window? I've written a COM object which is registered and has a
typelib (OLB) file created. Then I start pythonwin and run makepy on the
object from there. When I look at the newly created "GUID".py file in gen_py
it looks like some dandy wrapper code, just what I would expect would be
there. But when I create this object using
win32com.client.Dispatch(ProgID), tab completion doesn't work on the
resultant object. This isn't such a big deal, except that the code I'm
using this object from depends on early binding to know whether an
interface has an interator on it and things like that. This used to work
with a previous (2.0) version of python. Running makepy on Excel works
fine, and tab completion works on it. A toy COM object I wrote with the
same compiler works fine as well. Ideas?
Compiler: Borland C++ 5.01
Python : 2.2.1 win32 binary from python.org
Python COM : win32all146 from starship
J. Toman
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list