Re: pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

Shaik Saleem Basha <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <[email protected]>
Thank you for your response I will to that .

But my issue is not only with Quickopc , I have installed OpenOPC in that also I’m getting same error

My code:

import OpenOPC

opc = OpenOPC.client()

Output Error:

Traceback (most recent call last):

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch

IDispatch = pythoncom.connect(IDispatch)

pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\OpenOPC.py", line 167, in __init__

self._opc = win32com.client.gencache.EnsureDispatch(c, 0)

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 527, in EnsureDispatch

disp = win32com.client.Dispatch(prog_id)

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch

dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName

return (_GetGoodDispatch(IDispatch, clsctx), userName)

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch

IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)

pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ".\test.py", line 7, in <module>

opc = OpenOPC.client()

File "C:\Users\Saleem\AppData\Local\Programs\Python\Python38-32\lib\site-packages\OpenOPC.py", line 173, in __init__

raise OPCError(error_msg)

OpenOPC.OPCError: Dispatch: Invalid class string

OpenOPC I have installed from here https://pypi.org/project/OpenOPC-Python3x/ and how to use examples is here http://openopc.sourceforge.net/api.html .

In my Case pywin32 is not matching with the version python I’m using .

Python version I’m using downloaded from here : https://www.python.org/ftp/python/3.8.5/python-3.8.5.exe

Pywin32 downloaded from here : https://github.com/mhammond/pywin32/releases/download/b228/pywin32-228.win32-py3.8.exe

Can you please suggest me the versions which I can use to solve this errors , because the same version I’m using in another windows laptop there I’m not getting this errors.

Thanks & Regards,

Saleem.

From: Tim Roberts
Sent: Wednesday, September 9, 2020 12:16 AM
To: [email protected]
Subject: Re: [python-win32] pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

Shaik Saleem Basha wrote:

> When I downloaded install python by default it installed 32bit

> version only so pywin32 also I installed 32bit only

> Quicopc library is installed

If QuickOPC is a 64-bit component, then you need to call it from a

64-bit process. This is not always an easy thing to determine. If a

company wants to support both 32-bit and 64-bit processes, then it has

to install two different COM servers. I suggest you describe your

problem to the QuickOPC folks; they would know right away if this were

the issue.

--

Tim Roberts, [email protected]

Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.