Ennakard
Ennakard

Reputation: 125

win32com.client.Dispatch() 32-64 bits Programs

i'm trying to create a com object with win32com in python. Using theses command :

import win32com.client
com_nxn = win32com.client.Dispatch("NxNNamespace.NxNNamespaceHelper")

I tried 2 times, first on my 64 bit python2.6 install with win32 64 bit install. I was able to make work the import win32com.client line. But the con_nxn command still doensn't work and give me the following error:

File "C:\Python26\lib\site-packages\win32com\client\dynamic.py", line 85, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)

pywintypes.com_error: (-2147221164, 'Classe non enregistr\xe9e', None, None)

On an other part with a python and win32com 32 Bit installation, all work fine, my Com object is created. I think the problem is that the software i'm trying to instantiate is in 32 bits and doesn't provide a 64bit Com object

So my Question is : How can i make it work on my python 64Bit? Can i use a win32Com 32 bit by some strange way (copying dll) on my python 64Bit? Or maybe the problem is not what i think it is, in that case if someOne can enlight me, i would be gratefull, i'm a total begginner with com Object :D

(i'm on windows 7 64 bits)

Thanks!

Upvotes: 1

Views: 18822

Answers (2)

madjardi
madjardi

Reputation: 5939

try this. i not sure in this solution
C:\Windows\SysWOW64>.\msiexec.exe /i 'path of application'

addition information is here

Upvotes: 0

Roger Upole
Roger Upole

Reputation: 454

Depending on how the object is implemented, you may be able to just change the activation context by adding clsctx=pythoncom.CLSCTX_LOCAL_SERVER to the args passed to Dispatch. If that doesn't work, then try CLSCTX_ACTIVATE_32_BIT_SERVER (0x40000) for the clsctx. If neither of those work, you still may be able to create an out of process proxy for the application using Control Panel->Administrative Tools->Component Services.

Upvotes: 3

Related Questions