Hi Mark, Python interface only invokes method without attributes, when called without brackets:
i.e: "ref.Update()" does not work, while "ref.Update" does invoke correct _method_ The code is not using Makepy, initial object reference gained via client.Dispatch('name') . I don't think that is win32py problem, and I don't have resources to zero on the bug, but possibly you know what can cause this behaviour ? Thank you, Alex > -----Original Message----- > From: Mark Hammond [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 13, 2005 2:01 PM > To: Alex Jouravlev; python-win32@python.org > Subject: RE: [python-win32] Possible bug: what information to provide > > > > > > One more strange thing: > > > > MakePy recognised the object as "IRepository" rather then > "Repository" > > > > > > I'm not sure what you mean here. Please post a complete code sample, > > > including all output that confuses you or you believe to be wrong. > > > > > Makepy.py output (fragment, for information about the Object) > > ----------------------------------------------- > > class IRepository(DispatchBaseClass): > > Right - that is normal. It is indeed the interface that has the method - > the "coclass" described in the file probably has a reference to that > interface - a coclass may implement many interfaces. > > > > The code above is not using makepy, even though it may have > > > been run. You > > > could try creating the object using > > > win32com.client.gencache.EnsureDispatch > > > > I tried, here is the result: > > ----------------------------------- > > >>> rep = win32com.client.gencache.EnsureDispatch('EA.Repository') > > Traceback (most recent call last): > > File "<interactive input>", line 1, in ? > > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line > > 543, in EnsureDispatch > > raise TypeError, "This COM object can not automate the makepy > > process - > > please run makepy manually for this object" > > TypeError: This COM object can not automate the makepy process - > > please run > > makepy manually for this object > > Sadly, this object is not providing its typeinfo at runtime. If > you can get > in touch with the developers, ask them to consider adding this IDispatch > typeinfo support - they already have the typeinfo available from their > typelib, so it should be quite easy to do. > > In the meantime, you need to explicitly "cast" your objects into these > makepy objects. You should start by running "makepy.py -i" (from a > command-prompt). Here is what I get when I pick some random lib: > > IAS Helper COM Component 1.0 Type Library > {6BC096BB-0CE6-11D1-BAAE-00C04FC2E20D}, lcid=0, major=1, minor=0 > >>> # Use these commands in Python code to auto generate .py support > >>> from win32com.client import gencache > >>> gencache.EnsureModule('{6BC096BB-0CE6-11D1-BAAE-00C04FC2E20D}', 0, 1, > 0) > > You should add these lines to your code - but with one change: > > > from win32com.client import gencache > > mod = gencache.EnsureModule('{6BC096BB-0CE6-11D1-BAAE-00C04FC2E20D}', 0, > 1, 0) > > Note the last line - 'mod ='. This will be the makepy module, as imported > from the gen_py directory. You can then write: > > rep = win32com.client.Dispatch('EA.Repository') > # Now 'cast' it to an IRepository object. > rep = mod.IRepository(rep) > > print repr(rep) # Should now print a repr that indicates it is a makepy > object. > > You will need to this whenever you get a "new" object. Eg, let's > say there > was a "GetApplication()" method on a repository. > > app = rep.GetApplication() > print repr(app) # will probably say "<COM object ...>" - not what > you want. > app = mod.IApplication(app) # Cast to a mythical IApplication object. > print repr(app) # should show the makepy object. > > Hope that makes sense, > > Mark > > _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32