3

I used to have 2 versions of CANoe installed on my PC. 7.6 and 8.2. I tried to create object using comtypes API. It used to call 7.2 version of CANoe by default. Everything worked fine until I uninstalled 8.2 version of CANoe from the PC. Now it starts complaining Invalid class string error. Is it because I haven't uninstalled 8.2 version properly?

import comtypes.client
CANOE_COM_APPLICATION = "CANoe.Application"
app = comtypes.client.CreateObject(CANOE_COM_APPLICATION)

WindowsError: [Error -2147221005] Invalid class string

user1681102
  • 193
  • 2
  • 4
  • 13
  • Traceback (most recent call last): File "C:\Users\Desktop\Canoe.py", line 49, in app = comtypes.client.CreateObject(CANOE_COM_APPLICATION) File "C:\Program Files (x86)\Python27\lib\site- packages\comtypes\client\__init__.py", line 225, in CreateObject clsid = comtypes. GUID. from_progid(progid) File "C:\Program Files (x86)\Python27\lib\site-packages\comtypes\GUID.py", line 81, in from_progid _CLSIDFromProgID(unicode(progid), byref(inst)) File "_ctypes/callproc.c", line 945, in GetResult – user1681102 Jul 24 '19 at 15:48

1 Answers1

0

I faced a very similar issue and it turned out to be the COM server registration.

Try this: 1. Run cmd and navigate to the installation directory for the version of CANoe you're using. In your case, it's the 7.2 directory. 2. Go into the Exec64 directory and run "canoe64 –regserver"