[python-win32] Win32: -2147418113, 'Catastrophic failure'

Steven Manross steven at manross.net
Tue May 23 13:04:41 EDT 2023


And just to reiterate what Mark said, but also validate that this is the case from code:

You should be able to run this without issue… (and validate pywin32 works fine)

mydict = win32com.client.Dispatch("Scripting.Dictionary")

… since the “Scripting.Dictionary” COM class lives on every windows installation since Windows 2000 (or earlier).

Steven
From: python-win32 <python-win32-bounces+steven=manross.net at python.org> On Behalf Of Pranav S Pawar
Sent: Monday, May 22, 2023 8:05 AM
To: Mark Hammond <mhammond at skippinet.com.au>; python-win32 at python.org
Subject: [python-win32] Win32: -2147418113, 'Catastrophic failure'

Hello Team,

My code was working fine from one week in jupyter notebook.
Today i just did a kernel restart in jupyter notebook and my code stopped working.

Not sure what happened after restart. Tried all options but not able to resolve.
So through to get help from here.

Basically i am trying to get erwin api through => win32com.client.Dispatch("erwin9.SCAPI")

but getting error.

Giving Code as well as error below.
Please advise what corrective action should be taken.
I have tried to upgrade pywin32 module but still same error.

Code:
import win32com.client
erwin = win32com.client.Dispatch("erwin9.SCAPI")
print('Connected')

Error:


com_error                                 Traceback (most recent call last)

File C:\Python310\lib\site-packages\win32com\client\dynamic.py:84, in _GetGoodDispatch(IDispatch, clsctx)

     83 try:

---> 84     IDispatch = pythoncom.connect(IDispatch)

     85 except pythoncom.ole_error:



com_error: (-2147221021, 'Operation unavailable', None, None)



During handling of the above exception, another exception occurred:



com_error                                 Traceback (most recent call last)

Input In [17], in <cell line: 3>()

      1 import win32com.client

----> 3 erwin = win32com.client.Dispatch("erwin9.SCAPI")

      5 print('Connected')



File C:\Python310\lib\site-packages\win32com\client\__init__.py:118, in Dispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToString, clsctx)

    116 """Creates a Dispatch based COM object."""

    117 assert UnicodeToString is None, "this is deprecated and will go away"

--> 118 dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch, userName, clsctx)

    119 return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)



File C:\Python310\lib\site-packages\win32com\client\dynamic.py:104, in _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)

    101     ## ??? else userName remains None ???

    102 else:

    103     userName = str(userName)

--> 104 return (_GetGoodDispatch(IDispatch, clsctx), userName)



File C:\Python310\lib\site-packages\win32com\client\dynamic.py:86, in _GetGoodDispatch(IDispatch, clsctx)

     84         IDispatch = pythoncom.connect(IDispatch)

     85     except pythoncom.ole_error:

---> 86         IDispatch = pythoncom.CoCreateInstance(

     87             IDispatch, None, clsctx, pythoncom.IID_IDispatch

     88         )

     89 else:

     90     # may already be a wrapped class.

     91     IDispatch = getattr(IDispatch, "_oleobj_", IDispatch)



com_error: (-2147418113, 'Catastrophic failure', None, None)

Thanks & Best Regards,

Pranav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20230523/bf4b469e/attachment-0001.html>


More information about the python-win32 mailing list