Hello

I'm working with an application developed in .NET Framework, but recently
migrated to .NET 6.
The application provides a number of COM components, and I am unable to
call them from python after the migration. Our other COM clients (Excel and
FORTRAN) work as before.

My code is as follows:

import os
import win32com.client

# Declaring objects
fluid = win32com.client.Dispatch("OurProduct.Object")

This fails with the stack trace below:

Traceback (most recent call last):
  File
"C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\client\dynamic.py",
line 84, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\OurProduct\Python\Flash_Sample.py", line 13,
in <module>
    fluid = win32com.client.Dispatch(" OurProduct.Object ")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\client\__init__.py",
line 118, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,
userName, clsctx)

 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\client\dynamic.py",
line 104, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\client\dynamic.py",
line 86, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147467262, 'No such interface supported', None,
None)

It's not apparent to me what the error could be. The component does
implement IDispatch.
Do you have any suggestions on how to troubleshoot this further, or what
the problem could be?

Thanks in advance,
Martin
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to