[python-win32] About COM

Tim Roberts timr at probo.com
Mon Jan 17 19:54:40 CET 2011


Somnath Naskar wrote:
>
> I am having an issue with 64 bit machine while using COM interface.I
> am describing my problem in details....
>
> 1. I have a 64 bit machine and there I have installed python 64 bit
> and 64 bit win32 module.
> 2. In that machine I have installed Lotus Domino Admin Client of 32
> bit version(because it's 64 bit version is not available.).
> 3. Now I am Dispatching the Com objects of the Domino like ...
>              
>                from win32com.client import Dispatch              
>               ses = Dispatch('Lotus.NotesSession')
>
> But I am getting the below error.
>     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
> pythoncom.IID_IDispatch)
>
> com_error: (-2147221164, 'Class not registered', None, None)
>
> Is there any work around for this scenario.I want a solution for this.
>

You cannot call a 32-bit in-process COM object from a 64-bit process. 
It is simply not possible.

You have several options.  You can try to create the object as an
out-of-process server, which means that it will run as a separate
executable, instead of as a DLL in your process.  The server has to
support this explicitly, but Lotus is big enough that it might be there:

    import pythoncom
    ses = Dispatch('Lotus.NotesSession',
clsctx=pythoncom.CLSCTX_LOCAL_SERVER)

If that doesn't work, you'll have to create your own 32-bit process to
communicate with Lotus, with some kind of cross-process scheme to pass
requests between you and the other process.

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



More information about the python-win32 mailing list