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
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to