OLE error

Find inspirations how to access the ZEN application model
Post Reply
user-4947
Posts: 14
Joined: Thu Jan 01, 1970 1:00 am

OLE error

Post by user-4947 »

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?
user-8
Posts: 63
Joined: Thu Jan 01, 1970 1:00 am

Post by user-8 »

What exact ZEN Version did you use? The latest is ZEN 2.6 HF2.
user-4947
Posts: 14
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4947 »

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.
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

The ZEN blue dlls point to two versions of ZEN in the Classes Root Registry
What you want to express most probably is the situation that there are two entries in the registry pointing at different DLLs of ZEN.

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.
user-4947
Posts: 14
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4947 »

How do I get rid of the unwanted entry?
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

How do I get rid of the unwanted entry?
To get rid of the unwanted entries I would recommend the following steps:
  1. unregister the current version with 'regasm /u'
  2. 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.
  3. When the registry does not contain entries with 'ZenWrapperLM' any more, register the current version with 'regasm'.
Now you should be on the 'save side' :)
user-4947
Posts: 14
Joined: Thu Jan 01, 1970 1:00 am

Still getting com_error

Post by user-4947 »

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)
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

The problems mentioned will be solved when installing Zen 2.6 HF5 (to be released soon ;-)
Post Reply