[python-win32] Making a COM server that accepts COM objects

Tim Roberts timr at probo.com
Wed Jan 9 13:05:53 EST 2019


Boylan, Ross wrote:
> I have a Python 3.7, 32 bit, COM server and am calling it from 32 bit Office 2010 in VBA.  I am attempting to pass some COM objects from VBA to Python.  The trace collector full output appears below, but I think the key clues are several messages like
>
> in <BSTImport.BSTImport object at 0x009F62F0>._QueryInterface_ with unsupported IID {00000003-0000-0000-C000-000000000046} ({00000003-0000-0000-C000-000000000046})

Those are not important.  The COM framework is just probing to find out 
what extras you support.  00000003-etc is IMarshal and 0000001B-etc is 
IStandardMarshal; both can be used to help in the RPC process.


> and, later,
>      rst = fedb.OpenRecordset("foo")
> AttributeError: 'PyIDispatch' object has no attribute 'OpenRecordset'

You can't just pass an Access database object to another process and 
expect it to work.  The support pieces aren't there.  Thus, the crux of 
your problem is this:

>      _reg_progid_ = "Fahy.BST"
>      # for unknown reasons the inprocess server isn't working
>      _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER

That's the problem you need to chase.  You need to be an in-process 
server if you want to share state with the original code.  What happens 
when you register yourself as in-process? Note that the registry has to 
look different for this.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3980 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-win32/attachments/20190109/460f3955/attachment.bin>


More information about the python-win32 mailing list