Problems with COM

scorder at incigna.com scorder at incigna.com
Wed Jun 14 11:27:03 EDT 2000


>def query_server(docBaseService, queryString):
>    searchService=docBaseService.SearchServices
>    resultSpace=win32com.client.Dispatch
>    debug("Querying... ")
>    searchService.SearchDocuments(queryString,resultSpace)
>    return resultSpace.Count
>

>My example above gives the following error on the line "return
>resultSpace.Count":
>AttributeError: Count
You are making resultSpace equal to the Dispatch function.

>The resultSpace object is a COM object that cannot be created beforehand.
>It has to be placed in a VARIANT that is fed to the function
>SearchDocuments.  How do I do this?  I tried creating a Dispatch object
>without specifying a type but it doesn't seem to work.

Looking at the ado examples in the Python Programming on Win32 book
there is an example of a connection object returning a recordset and a
return code.  It looks like this:

(adoRS, success) = adoConn.Execute('Select * from Clients')

I dont' know if this is an automatically built in method of handling
COM parameters passed by reference or not.  It could be that you have
to run MakePy on it for it to work.  Anyway MakePy will speed up your
script because you won't be late binding the objects anymore.

>Thank you in advance for any solution or direction to relevant
>documentation.
>I will be happy to provide more details if I have not been precise enough.
>
>Jean-Louis Couturier
>Developer
>Ixiasoft
>
>
>


Sam Corder
Fledgling python developer



More information about the Python-list mailing list