I call ZEN blue objects from Python. Since we upgraded to the newest ZEN blue version, we are getting the following error message:
com_error: (-2146233079, 'OLE error 0x80131509', (0, None, u'This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.', None, 0, -2146233079), None)
when trying to access a hardware component.
We unregistered / registered the dlls after the software upgrade. We did not change our code and it worked before.
Any idea what is going on?
OLE error
Our IT department looked at the registry and discovered the following issues:
The ZEN blue dlls point to two versions (2.6.18298.1 and 2.6.18345.1) of ZEN in the Classes Root Registry
There are two copies of ZEN dlls on the C: drive. The dlls were modified at different dates.
Some .tlb files are being created for both versions because of dll conflicts.
The ZEN blue dlls point to two versions (2.6.18298.1 and 2.6.18345.1) of ZEN in the Classes Root Registry
There are two copies of ZEN dlls on the C: drive. The dlls were modified at different dates.
Some .tlb files are being created for both versions because of dll conflicts.
What you want to express most probably is the situation that there are two entries in the registry pointing at different DLLs of ZEN.The ZEN blue dlls point to two versions of ZEN in the Classes Root Registry
This usually happens when the DLLs of the first version of ZEN, that are registered [via regasm], are not unregistered [/u] before the DLLs of the second version of ZEN are registered.
To get rid of the unwanted entries I would recommend the following steps:How do I get rid of the unwanted entry?
- unregister the current version with 'regasm /u'
- Start 'regedit.exe',
mark the top node 'Computer' in the tree on the left hand side,
in the menu select 'Edit, Find' and search for 'ZenWrapperLM',
disable 'search for whole string',
press 'Find' or [F3] to find the entries one by one.
For each found entry the containing node is marked in the tree. I always (except 'Find'-node) delete this node. - When the registry does not contain entries with 'ZenWrapperLM' any more, register the current version with 'regasm'.
Still getting com_error
Unfortunately, this approach did not work. In addition I used PowerShell and removed all other old registry entries.
I am still getting the error:
com_error: (-2146233079, 'OLE error 0x80131509', (0, None, u'This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.', None, 0, -2146233079), None)
I believe it happens when calling the Devices object:
* >>> self
<__main__.connectMicroscope instance at 0x000000000BF446C8>
* >>> self.Zen
<COMObject Zeiss.Micro.Scripting.ZenWrapperLM>
* >>> self.Zen.Devices
Traceback (most recent call last):
File "D:\Users\winfriedw.ALLENINST\.p2\pool\plugins\org.python.pydev.core_7.0.3.201811082356\pysrc\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<console>", line 1, in <module>
File "D:\Automation\Anaconda\envs\microscope_automation\lib\site-packages\win32com\client\dynamic.py", line 516, in __getattr__
ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)
com_error: (-2146233079, 'OLE error 0x80131509', (0, None, u'This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.', None, 0, -2146233079), None)
I am still getting the error:
com_error: (-2146233079, 'OLE error 0x80131509', (0, None, u'This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.', None, 0, -2146233079), None)
I believe it happens when calling the Devices object:
* >>> self
<__main__.connectMicroscope instance at 0x000000000BF446C8>
* >>> self.Zen
<COMObject Zeiss.Micro.Scripting.ZenWrapperLM>
* >>> self.Zen.Devices
Traceback (most recent call last):
File "D:\Users\winfriedw.ALLENINST\.p2\pool\plugins\org.python.pydev.core_7.0.3.201811082356\pysrc\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<console>", line 1, in <module>
File "D:\Automation\Anaconda\envs\microscope_automation\lib\site-packages\win32com\client\dynamic.py", line 516, in __getattr__
ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)
com_error: (-2146233079, 'OLE error 0x80131509', (0, None, u'This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.', None, 0, -2146233079), None)